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 s m a. Monad m => ExceptT String m a -> ParserT s m a
Lift 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 s m a. Monad m => Either String a -> ParserT s m a
Lift 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 s m a. Monad m => String -> Maybe a -> ParserT s m a
Lift 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.Internal.Common
#Bytes Source
newtype Bytes
Representation of a bytes Scalar Value Type field.
On a message which has been decoded,
The wrapped DataBuff
will usually be a DataView
.
In that case, the DataView
is a view into the
received message I/O buffer.
For messages which you intend to encode,
You may set it the DataBuff
to DataView
or ArrayBuffer
,
whichever seems best.
The ArrayBuffer
and DataView
are mutable, so be careful not to mutate
them if anything might read them again. Here we trade off typechecker
guarantees for implementation simplicity.
Constructors
Instances
Re-exports from Protobuf.Internal.Runtime
#manyLength Source
manyLength :: forall m a. 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.