proto-lens- A lens-based implementation of protocol buffers in Haskell.

Safe HaskellNone



An assorted collection of functions useful when working with ProtoLens protocol buffers. These functions are inspired by functionality found in the protobuf implementation in other languages.



has :: Phantom f => LensLike f a a' (Maybe b) b' -> LensLike f a a' Bool b'' Source #

Turns a LensLike getting a Maybe into a Getter of a Bool that returns True when the Maybe is Just something.

I.e., makes a getter for a Maybe field that returns whether it's set.

clear :: Setter a a' b (Maybe b') -> a -> a' Source #

Sets the provided lens in a to Nothing.

make :: Message msg => State msg a -> msg Source #

Creates a Default and then applies the provided State to it. This is convenient for creating complicated structures.

modifyInState :: s -> State s a -> s Source #

Allows one to modify a value in the State monad. Note that this is just for syntactic convenience with do blocks, e.g.

   newThing = modifyInState thing $ do