proto-lens-0.7.1.6: A lens-based implementation of protocol buffers in Haskell.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.ProtoLens.Prism

Description

This module defines the Prism type and combinators. Used for building Prisms for oneof fields.

Synopsis

Documentation

type Prism s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #

type Prism' s a = Prism s s a a Source #

type AReview t b = Optic' (Tagged :: Type -> Type -> Type) Identity t b Source #

(#) :: AReview t b -> b -> t infixr 8 Source #

Used for constructing Prism values.

_Just # 5 == Just 5

prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b Source #

Build a Prism.

Either t a is used instead of Maybe a to permit the types of s and t to differ.

prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b Source #

This is usually used to build a Prism', when you have to use an operation like cast which already returns a Maybe.

_Left :: forall a c b p f. (Choice p, Applicative f) => p a (f b) -> p (Either a c) (f (Either b c)) Source #

_Right :: forall c a b p f. (Choice p, Applicative f) => p a (f b) -> p (Either c a) (f (Either c b)) Source #

_Just :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Maybe a) (f (Maybe b)) Source #

_Nothing :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Maybe a) (f (Maybe a)) Source #