Protobuf.Internal.Prelude
- Package
- purescript-protobuf
- Repository
- xc-jp/purescript-protobuf
The prelude for generated code.
Re-exports from Control.Alt
Re-exports from Control.Monad.Rec.Class
#MonadRec Source
class MonadRec :: (Type -> Type) -> Constraintclass (Monad m) <= MonadRec m
This type class captures those monads which support tail recursion in constant stack space.
The tailRecM function takes a step function, and applies that step
function recursively until a pure value of type b is found.
Instances are provided for standard monad transformers.
For example:
loopWriter :: Int -> WriterT (Additive Int) Effect Unit
loopWriter n = tailRecM go n
where
go 0 = do
traceM "Done!"
pure (Done unit)
go i = do
tell $ Additive i
pure (Loop (i - 1))
Instances
Re-exports from Data.Array
Re-exports from Data.ArrayBuffer.Builder
#PutM Source
type PutM :: (Type -> Type) -> Type -> Typetype PutM = WriterT Builder
The PutM monad is a WriterT Builder transformer monad which
gives us do-notation for the Builder monoid. The base monad must be
a MonadEffect.
To append Builders in this monad call tell, or any of the put*
functions in this module.
Re-exports from Data.ArrayBuffer.Types
#DataView Source
data DataViewRepresents a JS DataView on an ArrayBuffer (a slice into the ArrayBuffer)
#ByteLength Source
type ByteLength = IntLength in bytes of a DataView or ArrayBuffer
Re-exports from Data.Bounded
#Bounded Source
Re-exports from Data.Bounded.Generic
#genericTop Source
genericTop :: forall a rep. Generic a rep => GenericTop rep => aA Generic implementation of the top member from the Bounded type class.
#genericBottom Source
genericBottom :: forall a rep. Generic a rep => GenericBottom rep => aA Generic implementation of the bottom member from the Bounded type class.
Re-exports from Data.Enum
#BoundedEnum Source
class (Bounded a, Enum a) <= BoundedEnum a Type class for finite enumerations.
This should not be considered a part of a numeric hierarchy, as in Haskell.
Rather, this is a type class for small, ordered sum types with
statically-determined cardinality and the ability to easily compute
successor and predecessor elements like DayOfWeek.
Laws:
succ bottom >>= succ >>= succ ... succ [cardinality - 1 times] == toppred top >>= pred >>= pred ... pred [cardinality - 1 times] == bottomforall a > bottom: pred a >>= succ == Just aforall a < top: succ a >>= pred == Just aforall a > bottom: fromEnum <$> pred a = pred (fromEnum a)forall a < top: fromEnum <$> succ a = succ (fromEnum a)e1 `compare` e2 == fromEnum e1 `compare` fromEnum e2toEnum (fromEnum a) = Just a
Instances
#Enum Source
class (Ord a) <= Enum a Type class for enumerations.
Laws:
- Successor:
all (a < _) (succ a) - Predecessor:
all (_ < a) (pred a) - Succ retracts pred:
pred >=> succ >=> pred = pred - Pred retracts succ:
succ >=> pred >=> succ = succ - Non-skipping succ:
b <= a || any (_ <= b) (succ a) - Non-skipping pred:
a <= b || any (b <= _) (pred a)
The retraction laws can intuitively be understood as saying that succ is
the opposite of pred; if you apply succ and then pred to something,
you should end up with what you started with (although of course this
doesn't apply if you tried to succ the last value in an enumeration and
therefore got Nothing out).
The non-skipping laws can intuitively be understood as saying that succ
shouldn't skip over any elements of your type. For example, without the
non-skipping laws, it would be permissible to write an Enum Int instance
where succ x = Just (x+2), and similarly pred x = Just (x-2).
Instances
Re-exports from Data.Enum.Generic
#genericSucc Source
genericSucc :: forall a rep. Generic a rep => GenericEnum rep => a -> Maybe aA Generic implementation of the succ member from the Enum type class.
#genericPred Source
genericPred :: forall a rep. Generic a rep => GenericEnum rep => a -> Maybe aA Generic implementation of the pred member from the Enum type class.
#genericCardinality Source
genericCardinality :: forall a rep. Generic a rep => GenericBoundedEnum rep => Cardinality aA Generic implementation of the cardinality member from the
BoundedEnum type class.
Re-exports from Data.Eq
#Eq Source
class Eq a whereThe Eq type class represents types which support decidable equality.
Eq instances should satisfy the following laws:
- Reflexivity:
x == x = true - Symmetry:
x == y = y == x - Transitivity: if
x == yandy == zthenx == z
Note: The Number type is not an entirely law abiding member of this
class due to the presence of NaN, since NaN /= NaN. Additionally,
computing with Number can result in a loss of precision, so sometimes
values that should be equivalent are not.
Members
Instances
Re-exports from Data.Float32
Re-exports from Data.Function
#flip Source
flip :: forall a b c. (a -> b -> c) -> b -> a -> cGiven a function that takes two arguments, applies the arguments to the function in a swapped order.
flip append "1" "2" == append "2" "1" == "21"
const 1 "two" == 1
flip const 1 "two" == const "two" 1 == "two"
Re-exports from Data.Generic.Rep
#Generic Source
class Generic a rep | a -> repThe Generic class asserts the existence of a type function from types
to their representations using the type constructors defined in this module.
Re-exports from Data.Int64
#Int64 Source
newtype Int64Signed two’s-complement 64-bit integer.
Instances
Show Int64The
Showinstance will suffix a lowercase ‘l’ for “long”. (SeetoString.)Eq Int64Ord Int64Bounded Int64Semiring Int64Ring Int64CommutativeRing Int64EuclideanRing Int64The
EuclideanRinginstance provides amodoperator which is only lawful if the divisor is in theIntrange, -2³¹ ≤ divisor ≤ 2³¹⁻¹.
Re-exports from Data.Maybe
#Maybe Source
data Maybe aThe Maybe type is used to represent optional values and can be seen as
something like a type-safe null, where Nothing is null and Just x
is the non-null value x.
Constructors
Instances
Functor MaybeThe
Functorinstance allows functions to transform the contents of aJustwith the<$>operator:f <$> Just x == Just (f x)Nothingvalues are left untouched:f <$> Nothing == NothingApply MaybeThe
Applyinstance allows functions contained within aJustto transform a value contained within aJustusing theapplyoperator:Just f <*> Just x == Just (f x)Nothingvalues are left untouched:Just f <*> Nothing == Nothing Nothing <*> Just x == NothingCombining
Functor's<$>withApply's<*>can be used transform a pure function to takeMaybe-typed arguments sof :: a -> b -> cbecomesf :: Maybe a -> Maybe b -> Maybe c:f <$> Just x <*> Just y == Just (f x y)The
Nothing-preserving behaviour of both operators means the result of an expression like the above but where any one of the values isNothingmeans the whole result becomesNothingalso:f <$> Nothing <*> Just y == Nothing f <$> Just x <*> Nothing == Nothing f <$> Nothing <*> Nothing == NothingApplicative MaybeThe
Applicativeinstance enables lifting of values intoMaybewith thepurefunction:pure x :: Maybe _ == Just xCombining
Functor's<$>withApply's<*>andApplicative'spurecan be used to pass a mixture ofMaybeand non-Maybetyped values to a function that does not usually expect them, by usingpurefor any value that is not alreadyMaybetyped:f <$> Just x <*> pure y == Just (f x y)Even though
pure = Justit is recommended to usepurein situations like this as it allows the choice ofApplicativeto be changed later without having to go through and replaceJustwith a new constructor.Alt MaybeThe
Altinstance allows for a choice to be made between twoMaybevalues with the<|>operator, where the firstJustencountered is taken.Just x <|> Just y == Just x Nothing <|> Just y == Just y Nothing <|> Nothing == NothingPlus MaybeThe
Plusinstance provides a defaultMaybevalue:empty :: Maybe _ == NothingAlternative MaybeThe
Alternativeinstance guarantees that there are bothApplicativeandPlusinstances forMaybe.Bind MaybeThe
Bindinstance allows sequencing ofMaybevalues and functions that return aMaybeby using the>>=operator:Just x >>= f = f x Nothing >>= f = NothingMonad MaybeThe
Monadinstance guarantees that there are bothApplicativeandBindinstances forMaybe. This also enables thedosyntactic sugar:do x' <- x y' <- y pure (f x' y')Which is equivalent to:
x >>= (\x' -> y >>= (\y' -> pure (f x' y')))Which is equivalent to:
case x of Nothing -> Nothing Just x' -> case y of Nothing -> Nothing Just y' -> Just (f x' y')Extend MaybeThe
Extendinstance allows sequencing ofMaybevalues and functions that accept aMaybe aand return a non-Mayberesult using the<<=operator.f <<= Nothing = Nothing f <<= x = Just (f x)Invariant Maybe(Semigroup a) => Semigroup (Maybe a)The
Semigroupinstance enables use of the operator<>onMaybevalues whenever there is aSemigroupinstance for the type theMaybecontains. The exact behaviour of<>depends on the "inner"Semigroupinstance, but generally captures the notion of appending or combining things.Just x <> Just y = Just (x <> y) Just x <> Nothing = Just x Nothing <> Just y = Just y Nothing <> Nothing = Nothing(Semigroup a) => Monoid (Maybe a)(Semiring a) => Semiring (Maybe a)(Eq a) => Eq (Maybe a)The
Eqinstance allowsMaybevalues to be checked for equality with==and inequality with/=whenever there is anEqinstance for the type theMaybecontains.Eq1 Maybe(Ord a) => Ord (Maybe a)The
Ordinstance allowsMaybevalues to be compared withcompare,>,>=,<and<=whenever there is anOrdinstance for the type theMaybecontains.Nothingis considered to be less than anyJustvalue.Ord1 Maybe(Bounded a) => Bounded (Maybe a)(Show a) => Show (Maybe a)The
Showinstance allowsMaybevalues to be rendered as a string withshowwhenever there is anShowinstance for the type theMaybecontains.Generic (Maybe a) _
#maybe Source
maybe :: forall a b. b -> (a -> b) -> Maybe a -> bTakes a default value, a function, and a Maybe value. If the Maybe
value is Nothing the default value is returned, otherwise the function
is applied to the value inside the Just and the result is returned.
maybe x f Nothing == x
maybe x f (Just y) == f y
Re-exports from Data.Newtype
#Newtype Source
class (Coercible t a) <= Newtype t a | t -> aA type class for newtypes to enable convenient wrapping and unwrapping,
and the use of the other functions in this module.
The compiler can derive instances of Newtype automatically:
newtype EmailAddress = EmailAddress String
derive instance newtypeEmailAddress :: Newtype EmailAddress _
Note that deriving for Newtype instances requires that the type be
defined as newtype rather than data declaration (even if the data
structurally fits the rules of a newtype), and the use of a wildcard for
the wrapped type.
Instances
Re-exports from Data.Ord
#Ord Source
class (Eq a) <= Ord a The Ord type class represents types which support comparisons with a
total order.
Ord instances should satisfy the laws of total orderings:
- Reflexivity:
a <= a - Antisymmetry: if
a <= bandb <= athena == b - Transitivity: if
a <= bandb <= cthena <= c
Note: The Number type is not an entirely law abiding member of this
class due to the presence of NaN, since NaN <= NaN evaluates to false
Instances
Re-exports from Data.Ord.Generic
#genericCompare Source
genericCompare :: forall a rep. Generic a rep => GenericOrd rep => a -> a -> OrderingA Generic implementation of the compare member from the Ord type class.
Re-exports from Data.Semigroup
Re-exports from Data.Show
#Show Source
class Show a The Show type class represents those types which can be converted into
a human-readable String representation.
While not required, it is recommended that for any expression x, the
string show x be executable PureScript code which evaluates to the same
value as the expression x.
Instances
Re-exports from Data.Show.Generic
#genericShow Source
genericShow :: forall a rep. Generic a rep => GenericShow rep => a -> StringA Generic implementation of the show member from the Show type class.
Re-exports from Data.String
Re-exports from Data.Tuple
#Tuple Source
data Tuple a bA simple product type for wrapping a pair of component values.
Constructors
Tuple a b
Instances
(Show a, Show b) => Show (Tuple a b)Allows
Tuples to be rendered as a string withshowwhenever there areShowinstances for both component types.(Eq a, Eq b) => Eq (Tuple a b)Allows
Tuples to be checked for equality with==and/=whenever there areEqinstances for both component types.(Eq a) => Eq1 (Tuple a)(Ord a, Ord b) => Ord (Tuple a b)Allows
Tuples to be compared withcompare,>,>=,<and<=whenever there areOrdinstances for both component types. To obtain the result, thefsts arecompared, and if they areEQual, thesnds arecompared.(Ord a) => Ord1 (Tuple a)(Bounded a, Bounded b) => Bounded (Tuple a b)Semigroupoid Tuple(Semigroup a, Semigroup b) => Semigroup (Tuple a b)The
Semigroupinstance enables use of the associative operator<>onTuples whenever there areSemigroupinstances for the component types. The<>operator is applied pairwise, so:(Tuple a1 b1) <> (Tuple a2 b2) = Tuple (a1 <> a2) (b1 <> b2)(Monoid a, Monoid b) => Monoid (Tuple a b)(Semiring a, Semiring b) => Semiring (Tuple a b)(Ring a, Ring b) => Ring (Tuple a b)(CommutativeRing a, CommutativeRing b) => CommutativeRing (Tuple a b)(HeytingAlgebra a, HeytingAlgebra b) => HeytingAlgebra (Tuple a b)(BooleanAlgebra a, BooleanAlgebra b) => BooleanAlgebra (Tuple a b)Functor (Tuple a)The
Functorinstance allows functions to transform the contents of aTuplewith the<$>operator, applying the function to the second component, so:f <$> (Tuple x y) = Tuple x (f y)Generic (Tuple a b) _Invariant (Tuple a)(Semigroup a) => Apply (Tuple a)The
Applyinstance allows functions to transform the contents of aTuplewith the<*>operator whenever there is aSemigroupinstance for thefstcomponent, so:(Tuple a1 f) <*> (Tuple a2 x) == Tuple (a1 <> a2) (f x)(Monoid a) => Applicative (Tuple a)(Semigroup a) => Bind (Tuple a)(Monoid a) => Monad (Tuple a)Extend (Tuple a)Comonad (Tuple a)(Lazy a, Lazy b) => Lazy (Tuple a b)
Re-exports from Data.UInt
Re-exports from Data.UInt64
Re-exports from Effect.Class
#MonadEffect Source
class MonadEffect :: (Type -> Type) -> Constraintclass (Monad m) <= MonadEffect m
The MonadEffect class captures those monads which support native effects.
Instances are provided for Effect itself, and the standard monad
transformers.
liftEffect can be used in any appropriate monad transformer stack to lift an
action of type Effect a into the monad.
Instances
Re-exports from Parsing
#ParserT Source
newtype ParserT :: Type -> (Type -> Type) -> Type -> Typenewtype ParserT s m a
The Parser s monad with a monad transformer parameter m.
Instances
Lazy (ParserT s m a)(Semigroup a) => Semigroup (ParserT s m a)(Monoid a) => Monoid (ParserT s m a)Functor (ParserT s m)Apply (ParserT s m)Applicative (ParserT s m)Bind (ParserT s m)Monad (ParserT s m)MonadRec (ParserT s m)(MonadState t m) => MonadState t (ParserT s m)(MonadAsk r m) => MonadAsk r (ParserT s m)(MonadReader r m) => MonadReader r (ParserT s m)MonadThrow ParseError (ParserT s m)MonadError ParseError (ParserT s m)Alt (ParserT s m)The alternative
Altinstance provides thealtcombinator<|>.The expression
p_left <|> p_rightwill first try thep_leftparser and if that fails and consumes no input then it will try thep_rightparser.While we are parsing down the
p_leftbranch we may reach a point where we know this is the correct branch, but we cannot parse further. At that point we want to fail the entire parse instead of trying thep_rightbranch.For example, consider this
fileParserwhich can parse either an HTML file that begins with<html>or a shell script file that begins with#!.fileParser = string "<html>" *> parseTheRestOfTheHtml <|> string "#!" *> parseTheRestOfTheScriptIf we read a file from disk and run this
fileParseron it and thestring "<html>"parser succeeds, then we know that the first branch is the correct branch, so we want to commit to the first branch. Even if theparseTheRestOfTheHtmlparser fails we don’t want to try the second branch.To control the point at which we commit to the
p_leftbranch use thetrycombinator and thelookAheadcombinator and theconsumefunction.The
altcombinator works this way because it gives us good localized error messages while also allowing an efficient implementation. See Parsec: Direct Style Monadic Parser Combinators For The Real World section 2.3 Backtracking.Plus (ParserT s m)Alternative (ParserT s m)MonadPlus (ParserT s m)MonadTrans (ParserT s)
Re-exports from Prelude
#Unit Source
data UnitThe Unit type has a single inhabitant, called unit. It represents
values with no computational content.
Unit is often used, wrapped in a monadic type constructor, as the
return type of a computation where only the effects are important.
When returning a value of type Unit from an FFI function, it is
recommended to use undefined, or not return a value at all.
#pure Source
pure :: forall f a. Applicative f => a -> f a#(>>>) Source
Operator alias for Control.Semigroupoid.composeFlipped (right-associative / precedence 9)
#($) Source
Operator alias for Data.Function.apply (right-associative / precedence 0)
Applies a function to an argument: the reverse of (#).
length $ groupBy productCategory $ filter isInStock $ products
is equivalent to:
length (groupBy productCategory (filter isInStock products))
Or another alternative equivalent, applying chain of composed functions to a value:
length <<< groupBy productCategory <<< filter isInStock $ products
Re-exports from Prim.Row
#Nub
#Union
Re-exports from Protobuf.Internal.Common
#FieldNumber Source
type FieldNumber = UInt#Bytes Source
newtype BytesRepresentation 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 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
#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” (zero) value.
The Protobuf spec requires that a no presence field set to its “default” (zero) value must not be serialized to the wire.
When receiving messages we can use this function to interpret a missing no presence field as a “default” value.
#fromDefault Source
fromDefault :: forall a. Default a => Eq a => a -> Maybe aTurns a “default” (zero) value into Nothing.
Re-exports from Protobuf.Internal.Decode
#decodeVarint32 Source
decodeVarint32 :: forall m. MonadEffect m => ParserT DataView m UIntThere is no varint32 in the Protbuf spec, this is
just a performance-improving assumption we make
in cases where we would be surprised to see a number
larger than 32 bits, such as in field numbers.
We think this is worth the risk because UInt is
represented as a native Javascript Number whereas
UInt64 is a composite library type, so we expect the
performance difference to be significant.
#decodeUint64 Source
decodeUint64 :: forall m. MonadEffect m => ParserT DataView m UInt64uint64 Scalar Value Type
#decodeUint32 Source
decodeUint32 :: forall m. MonadEffect m => ParserT DataView m UIntuint32 Scalar Value Type
#decodeTag32 Source
decodeTag32 :: forall m. MonadEffect m => ParserT DataView m (Tuple FieldNumber WireType)Parse the field number and wire type of the next field. https://protobuf.dev/programming-guides/encoding#structure
#decodeString Source
decodeString :: forall m. MonadEffect m => ParserT DataView m Stringstring Scalar Value Type
#decodeSint64 Source
decodeSint64 :: forall m. MonadEffect m => ParserT DataView m Int64sint64 Scalar Value Type
#decodeSint32 Source
decodeSint32 :: forall m. MonadEffect m => ParserT DataView m Intsint32 Scalar Value Type
#decodeSfixed64Array Source
decodeSfixed64Array :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array Int64)repeated packed sfixed64
Equivalent to manyLength decodeSfixed64, but specialized so it’s faster.
#decodeSfixed64 Source
decodeSfixed64 :: forall m. MonadEffect m => ParserT DataView m Int64sfixed64 Scalar Value Type
#decodeSfixed32Array Source
decodeSfixed32Array :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array Int)repeated packed sfixed32
Equivalent to manyLength decodeSfixed32, but specialized so it’s faster.
#decodeSfixed32 Source
decodeSfixed32 :: forall m. MonadEffect m => ParserT DataView m Intsfixed32 Scalar Value Type
#decodeInt64 Source
decodeInt64 :: forall m. MonadEffect m => ParserT DataView m Int64int64 Scalar Value Type
#decodeInt32 Source
decodeInt32 :: forall m. MonadEffect m => ParserT DataView m Intint32 Scalar Value Type
#decodeFloatArray Source
decodeFloatArray :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array Float32)repeated packed float
Equivalent to manyLength decodeFloat, but specialized so it’s faster.
#decodeFloat Source
decodeFloat :: forall m. MonadEffect m => ParserT DataView m Float32float Scalar Value Type
#decodeFixed64Array Source
decodeFixed64Array :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array UInt64)repeated packed fixed64
Equivalent to manyLength decodeFixed64, but specialized so it’s faster.
#decodeFixed64 Source
decodeFixed64 :: forall m. MonadEffect m => ParserT DataView m UInt64fixed64 Scalar Value Type
#decodeFixed32Array Source
decodeFixed32Array :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array UInt)repeated packed fixed32
Equivalent to manyLength decodeFixed32, but specialized so it’s faster.
#decodeFixed32 Source
decodeFixed32 :: forall m. MonadEffect m => ParserT DataView m UIntfixed32 Scalar Value Type
#decodeDoubleArray Source
decodeDoubleArray :: forall m. MonadEffect m => ByteLength -> ParserT DataView m (Array Number)repeated packed double
Equivalent to manyLength decodeDouble, but specialized so it’s faster.
#decodeDouble Source
decodeDouble :: forall m. MonadEffect m => ParserT DataView m Numberdouble Scalar Value Type
#decodeBytes Source
decodeBytes :: forall m. MonadEffect m => ParserT DataView m Bytesbytes Scalar Value Type
#decodeBool Source
decodeBool :: forall m. MonadEffect m => ParserT DataView m Booleanbool Scalar Value Type
Re-exports from Protobuf.Internal.Encode
#encodeVarint64 Source
encodeVarint64 :: forall m. MonadEffect m => UInt64 -> PutM m Unit#encodeVarint32 Source
encodeVarint32 :: forall m. MonadEffect m => UInt -> PutM m UnitThere is no varint32 in the Protbuf spec, this is
just a performance-improving assumption we make
in cases where we would be surprised to see a number
larger than 32 bits, such as in field numbers.
We think this is worth the risk because UInt is
represented as a native Javascript Number whereas
UInt64 is a composite library type, so we expect the
performance difference to be significant.
#encodeUint64Field Source
encodeUint64Field :: forall m. MonadEffect m => FieldNumber -> UInt64 -> PutM m Unit#encodeUint64 Source
encodeUint64 :: forall m. MonadEffect m => UInt64 -> PutM m Unituint64 Scalar Value Type
#encodeUint32Field Source
encodeUint32Field :: forall m. MonadEffect m => FieldNumber -> UInt -> PutM m Unit#encodeUint32 Source
encodeUint32 :: forall m. MonadEffect m => UInt -> PutM m Unituint32 Scalar Value Type
#encodeTag32 Source
encodeTag32 :: forall m. MonadEffect m => FieldNumber -> WireType -> PutM m Unit
#encodeStringField Source
encodeStringField :: forall m. MonadEffect m => FieldNumber -> String -> PutM m Unitstring Scalar Value Type
#encodeSint64Field Source
encodeSint64Field :: forall m. MonadEffect m => FieldNumber -> Int64 -> PutM m Unit#encodeSint64 Source
encodeSint64 :: forall m. MonadEffect m => Int64 -> PutM m Unitsint64 Scalar Value Type
#encodeSint32Field Source
encodeSint32Field :: forall m. MonadEffect m => FieldNumber -> Int -> PutM m Unit#encodeSint32 Source
encodeSint32 :: forall m. MonadEffect m => Int -> PutM m Unitsint32 Scalar Value Type
#encodeSfixed64Field Source
encodeSfixed64Field :: forall m. MonadEffect m => FieldNumber -> Int64 -> PutM m Unit#encodeSfixed64 Source
encodeSfixed64 :: forall m. MonadEffect m => Int64 -> PutM m Unitsfixed64 Scalar Value Type
#encodeSfixed32Field Source
encodeSfixed32Field :: forall m. MonadEffect m => FieldNumber -> Int -> PutM m Unit#encodeSfixed32 Source
encodeSfixed32 :: forall m. MonadEffect m => Int -> PutM m Unitsfixed32 Scalar Value Type
#encodeInt64Field Source
encodeInt64Field :: forall m. MonadEffect m => FieldNumber -> Int64 -> PutM m Unit#encodeInt64 Source
encodeInt64 :: forall m. MonadEffect m => Int64 -> PutM m Unitint64 Scalar Value Type
#encodeInt32Field Source
encodeInt32Field :: forall m. MonadEffect m => FieldNumber -> Int -> PutM m Unit#encodeInt32 Source
encodeInt32 :: forall m. MonadEffect m => Int -> PutM m Unitint32 Scalar Value Type
#encodeFloatField Source
encodeFloatField :: forall m. MonadEffect m => FieldNumber -> Float32 -> PutM m Unit#encodeFloat Source
encodeFloat :: forall m. MonadEffect m => Float32 -> PutM m Unitfloat Scalar Value Type
#encodeFixed64Field Source
encodeFixed64Field :: forall m. MonadEffect m => FieldNumber -> UInt64 -> PutM m Unit#encodeFixed64 Source
encodeFixed64 :: forall m. MonadEffect m => UInt64 -> PutM m Unitfixed64 Scalar Value Type
#encodeFixed32Field Source
encodeFixed32Field :: forall m. MonadEffect m => FieldNumber -> UInt -> PutM m Unit#encodeFixed32 Source
encodeFixed32 :: forall m. MonadEffect m => UInt -> PutM m Unitfixed32 Scalar Value Type
#encodeDoubleField Source
encodeDoubleField :: forall m. MonadEffect m => FieldNumber -> Number -> PutM m Unit#encodeDouble Source
encodeDouble :: forall m. MonadEffect m => Number -> PutM m Unitdouble Scalar Value Type
#encodeBytesField Source
encodeBytesField :: forall m. MonadEffect m => FieldNumber -> Bytes -> PutM m Unitbytes Scalar Value Type
#encodeBuilder Source
encodeBuilder :: forall m. MonadEffect m => FieldNumber -> Builder -> PutM m Unittell with a tag and a length delimit.
#encodeBoolField Source
encodeBoolField :: forall m. MonadEffect m => FieldNumber -> Boolean -> PutM m Unit#encodeBool Source
encodeBool :: forall m. MonadEffect m => Boolean -> PutM m Unitbool Scalar Value Type
Re-exports from Protobuf.Internal.Runtime
#UnknownField Source
data UnknownFieldA message field value from an unknown .proto definition.
See Message Structure for an explanation.
UnknownVarIntUseProtobuf.Internal.Decode.decodeZigzag64to interpret this as a signed integer.UnknownLenDelholds a variable-lengthBytes.UnknownBits64must holdBytesof length 8.UnknownBits32must holdBytesof length 4.
See the modules Protobuf.Internal.Encode
and Protobuf.Internal.Decode for ways to operate on the Bytes.
Constructors
UnknownVarInt FieldNumber UInt64UnknownBits64 FieldNumber BytesUnknownLenDel FieldNumber BytesUnknownBits32 FieldNumber Bytes
Instances
#FieldNumberInt Source
type FieldNumberInt = IntWe want an Int FieldNumber to pass to parseField so that we can pattern match on Int literals. UInt doesn't export any constructors, so we can’t pattern match on it.
#putRepeated Source
putRepeated :: forall m a. MonadEffect m => MonadRec m => FieldNumberInt -> Array a -> (FieldNumber -> a -> PutM m Unit) -> PutM m Unit#putPacked Source
putPacked :: forall m a. MonadEffect m => MonadRec m => FieldNumberInt -> Array a -> (a -> PutM m Unit) -> PutM m Unit#putOptional Source
putOptional :: forall m a. MonadEffect m => FieldNumberInt -> Maybe a -> (a -> Boolean) -> (FieldNumber -> a -> PutM m Unit) -> PutM m Unit#putLenDel Source
putLenDel :: forall m a. MonadEffect m => (a -> PutM m Unit) -> FieldNumber -> a -> PutM m Unit#putFieldUnknown Source
putFieldUnknown :: forall m. MonadEffect m => UnknownField -> PutM m Unit#putEnumField Source
putEnumField :: forall m a. MonadEffect m => BoundedEnum a => FieldNumber -> a -> PutM m Unit#putEnum Source
putEnum :: forall m a. MonadEffect m => BoundedEnum a => a -> PutM m Unit#parseMessage Source
parseMessage :: forall m a r. MonadEffect m => MonadRec m => (Record r -> a) -> (Record r) -> (FieldNumberInt -> WireType -> ParserT DataView m (Builder (Record r) (Record r))) -> ByteLength -> ParserT DataView m aThe parseField argument is a parser which returns a Record builder which, when applied to a Record, will modify the Record to add the parsed field.
#parseLenDel Source
parseLenDel :: forall m a. MonadEffect m => (Int -> ParserT DataView m a) -> ParserT DataView m aParse a length, then call a parser which takes one length as its argument.
#parseFieldUnknown Source
parseFieldUnknown :: forall m r. MonadEffect m => Int -> WireType -> ParserT DataView m (Builder ({ __unknown_fields :: Array UnknownField | r }) ({ __unknown_fields :: Array UnknownField | r }))Parse and preserve an unknown field.
#parseEnum Source
parseEnum :: forall m a. MonadEffect m => BoundedEnum a => ParserT DataView m a#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.
Re-exports from Record
Re-exports from Record.Builder
#Builder Source
newtype Builder a bA Builder can be used to build a record by incrementally adding
fields in-place, instead of using insert and repeatedly generating new
immutable records which need to be garbage collected.
The mutations accumulated in a Builder are safe because intermediate states can't be
observed. These mutations, then, are performed all-at-once in the build function.
The Category instance for Builder can be used to compose builders.
For example:
build (insert x 42 >>> insert y "testing") {} :: { x :: Int, y :: String }
The
BoundedIntinstance hastop :: Intequal to 2^31 - 1, andbottom :: Intequal to -2^31, since these are the largest and smallest integers representable by twos-complement 32-bit integers, respectively.