Protobuf.Library
- Package
- purescript-protobuf
- Repository
- xc-jp/purescript-protobuf
Module for types to be imported by a progam which uses protobuf.
#parseExceptT Source
parseExceptT :: forall a m s. Monad m => ExceptT String m a -> ParserT s m aLift an ExceptT String m computation into a ParserT.
Consumes no parsing input, does not change the parser state at all.
If the ExceptT computation is Left, then this will fail in the
ParserT monad.
#parseEither Source
parseEither :: forall a m s. Monad m => Either String a -> ParserT s m aLift an Either String computation into a ParserT.
Consumes no parsing input, does not change the parser state at all.
If the Either computation is Left, then this will fail in the
ParserT monad.
#parseMaybe Source
parseMaybe :: forall a m s. Monad m => String -> Maybe a -> ParserT s m aLift a Maybe computation into a ParserT, with a note for
the ParseError message in case of Nothing.
Consumes no parsing input, does not change the parser state at all.
If the Maybe computation is Nothing, then this will fail in the
ParserT monad.
Re-exports from Protobuf.Common
#Default Source
class Default a whereIn Protobuf, zero values are “default values” and have special semantics.
Members
Instances
#toDefault Source
toDefault :: forall a. Default a => Maybe a -> aTurns Nothing into a default value.
The Protobuf spec requires that a field being set to zero (“default”) and a missing field are equivalent states. Because of this, there is no way to tell whether a missing field from a received message is really missing or if the sender meant that the field value is zero. We can use this function to manually choose whether we want a missing field to mean that it’s missing, or to mean that it’s zero.
#fromDefault Source
fromDefault :: forall a. Default a => Eq a => a -> Maybe aTurns a default value into Nothing.
Re-exports from Protobuf.Runtime
#manyLength Source
manyLength :: forall a m. MonadEffect m => MonadRec m => ParserT DataView m a -> ByteLength -> ParserT DataView m (Array a)Call a parser repeatedly until exactly N bytes have been consumed. Will fail if too many bytes are consumed.