Module

Protobuf.Internal.Prelude

Package
purescript-protobuf
Repository
xc-jp/purescript-protobuf

The prelude for generated code.

Re-exports from Control.Alt

#alt Source

alt :: forall f a. Alt f => f a -> f a -> f a

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

#snoc Source

snoc :: forall a. Array a -> a -> Array a

Append an element to the end of an array, creating a new array.

snoc [1, 2, 3] 4 = [1, 2, 3, 4]

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 DataView

Represents a JS DataView on an ArrayBuffer (a slice into the ArrayBuffer)

#ByteLength Source

type ByteLength = Int

Length in bytes of a DataView or ArrayBuffer

Re-exports from Data.Bounded

#Bounded Source

class (Ord a) <= Bounded a 

The Bounded type class represents totally ordered types that have an upper and lower boundary.

Instances should satisfy the following law in addition to the Ord laws:

  • Bounded: bottom <= a <= top

Instances

Re-exports from Data.Bounded.Generic

#genericTop Source

genericTop :: forall a rep. Generic a rep => GenericTop rep => a

A Generic implementation of the top member from the Bounded type class.

#genericBottom Source

genericBottom :: forall a rep. Generic a rep => GenericBottom rep => a

A 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] == top
  • pred top >>= pred >>= pred ... pred [cardinality - 1 times] == bottom
  • forall a > bottom: pred a >>= succ == Just a
  • forall a < top: succ a >>= pred == Just a
  • forall a > bottom: fromEnum <$> pred a = pred (fromEnum a)
  • forall a < top: fromEnum <$> succ a = succ (fromEnum a)
  • e1 `compare` e2 == fromEnum e1 `compare` fromEnum e2
  • toEnum (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 a

A Generic implementation of the succ member from the Enum type class.

#genericPred Source

genericPred :: forall a rep. Generic a rep => GenericEnum rep => a -> Maybe a

A Generic implementation of the pred member from the Enum type class.

#genericCardinality Source

genericCardinality :: forall a rep. Generic a rep => GenericBoundedEnum rep => Cardinality a

A Generic implementation of the cardinality member from the BoundedEnum type class.

Re-exports from Data.Eq

#Eq Source

class Eq a  where

The 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 == y and y == z then x == 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 -> c

Given 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 -> rep

The 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 Int64

Signed two’s-complement 64-bit integer.

Instances

Re-exports from Data.Maybe

#Maybe Source

data Maybe a

The 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 Maybe

    The Functor instance allows functions to transform the contents of a Just with the <$> operator:

    f <$> Just x == Just (f x)
    

    Nothing values are left untouched:

    f <$> Nothing == Nothing
    
  • Apply Maybe

    The Apply instance allows functions contained within a Just to transform a value contained within a Just using the apply operator:

    Just f <*> Just x == Just (f x)
    

    Nothing values are left untouched:

    Just f <*> Nothing == Nothing
    Nothing <*> Just x == Nothing
    

    Combining Functor's <$> with Apply's <*> can be used transform a pure function to take Maybe-typed arguments so f :: a -> b -> c becomes f :: 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 is Nothing means the whole result becomes Nothing also:

    f <$> Nothing <*> Just y == Nothing
    f <$> Just x <*> Nothing == Nothing
    f <$> Nothing <*> Nothing == Nothing
    
  • Applicative Maybe

    The Applicative instance enables lifting of values into Maybe with the pure function:

    pure x :: Maybe _ == Just x
    

    Combining Functor's <$> with Apply's <*> and Applicative's pure can be used to pass a mixture of Maybe and non-Maybe typed values to a function that does not usually expect them, by using pure for any value that is not already Maybe typed:

    f <$> Just x <*> pure y == Just (f x y)
    

    Even though pure = Just it is recommended to use pure in situations like this as it allows the choice of Applicative to be changed later without having to go through and replace Just with a new constructor.

  • Alt Maybe

    The Alt instance allows for a choice to be made between two Maybe values with the <|> operator, where the first Just encountered is taken.

    Just x <|> Just y == Just x
    Nothing <|> Just y == Just y
    Nothing <|> Nothing == Nothing
    
  • Plus Maybe

    The Plus instance provides a default Maybe value:

    empty :: Maybe _ == Nothing
    
  • Alternative Maybe

    The Alternative instance guarantees that there are both Applicative and Plus instances for Maybe.

  • Bind Maybe

    The Bind instance allows sequencing of Maybe values and functions that return a Maybe by using the >>= operator:

    Just x >>= f = f x
    Nothing >>= f = Nothing
    
  • Monad Maybe

    The Monad instance guarantees that there are both Applicative and Bind instances for Maybe. This also enables the do syntactic 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 Maybe

    The Extend instance allows sequencing of Maybe values and functions that accept a Maybe a and return a non-Maybe result using the <<= operator.

    f <<= Nothing = Nothing
    f <<= x = Just (f x)
    
  • Invariant Maybe
  • (Semigroup a) => Semigroup (Maybe a)

    The Semigroup instance enables use of the operator <> on Maybe values whenever there is a Semigroup instance for the type the Maybe contains. The exact behaviour of <> depends on the "inner" Semigroup instance, 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 Eq instance allows Maybe values to be checked for equality with == and inequality with /= whenever there is an Eq instance for the type the Maybe contains.

  • Eq1 Maybe
  • (Ord a) => Ord (Maybe a)

    The Ord instance allows Maybe values to be compared with compare, >, >=, < and <= whenever there is an Ord instance for the type the Maybe contains.

    Nothing is considered to be less than any Just value.

  • Ord1 Maybe
  • (Bounded a) => Bounded (Maybe a)
  • (Show a) => Show (Maybe a)

    The Show instance allows Maybe values to be rendered as a string with show whenever there is an Show instance for the type the Maybe contains.

  • Generic (Maybe a) _

#maybe Source

maybe :: forall a b. b -> (a -> b) -> Maybe a -> b

Takes 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 -> a

A 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 <= b and b <= a then a == b
  • Transitivity: if a <= b and b <= c then a <= 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 -> Ordering

A Generic implementation of the compare member from the Ord type class.

Re-exports from Data.Semigroup

#(<>) Source

Operator alias for Data.Semigroup.append (right-associative / precedence 5)

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 -> String

A Generic implementation of the show member from the Show type class.

Re-exports from Data.String

#joinWith Source

joinWith :: String -> Array String -> String

Joins the strings in the array together, inserting the first argument as separator between them.

joinWith ", " ["apple", "banana", "orange"] == "apple, banana, orange"

Re-exports from Data.Traversable

#traverse_ Source

traverse_ :: forall a b f m. Applicative m => Foldable f => (a -> m b) -> f a -> m Unit

Traverse a data structure, performing some effects encoded by an Applicative functor at each value, ignoring the final result.

For example:

traverse_ print [1, 2, 3]

Re-exports from Data.Tuple

#Tuple Source

data Tuple a b

A simple product type for wrapping a pair of component values.

Constructors

Instances

Re-exports from Data.UInt

#UInt Source

newtype UInt

32-bit unsigned integer. Range from 0 to 4294967295.

Instances

#toInt Source

toInt :: UInt -> Int

Cast an UInt to an Int turning UInts in range from 2^31 to 2^32-1 into negative Ints.

> toInt (fromInt 123)
123

> toInt (fromInt (-1))
-1

#fromInt Source

fromInt :: Int -> UInt

Cast an Int to an UInt turning negative Ints into UInts in range from 2^31 to 2^32-1.

> fromInt 123
123u

> fromInt (-123)
4294967173u

Re-exports from Data.UInt64

#UInt64 Source

newtype UInt64

Unsigned 64-bit integer.

Instances

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

Re-exports from Prelude

#Unit Source

data Unit

The 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.

#append Source

append :: forall a. Semigroup a => a -> a -> a

#bind Source

bind :: forall m a b. Bind m => m a -> (a -> m b) -> m b

#discard Source

discard :: forall a f b. Discard a => Bind f => f a -> (a -> f b) -> f b

#map Source

map :: forall f a b. Functor f => (a -> b) -> f a -> f b

#pure Source

pure :: forall f a. Applicative f => a -> f a

#unit Source

unit :: Unit

unit is the sole inhabitant of the Unit type.

#negate Source

negate :: forall a. Ring a => a -> a

negate x can be used as a shorthand for zero - x.

#(>>>) Source

Operator alias for Control.Semigroupoid.composeFlipped (right-associative / precedence 9)

#(>>=) Source

Operator alias for Control.Bind.bind (left-associative / precedence 1)

#(<<<) Source

Operator alias for Control.Semigroupoid.compose (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

class Nub (original :: Row k) (nubbed :: Row k) | original -> nubbed

The Nub type class is used to remove duplicate labels from rows.

#Union

class Union (left :: Row k) (right :: Row k) (union :: Row k) | left right -> union, right union -> left, union left -> right

The Union type class is used to compute the union of two rows of types (left-biased, including duplicates).

The third type argument represents the union of the first two.

Re-exports from Protobuf.Internal.Common

#FieldNumber Source

#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 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  where

In Protobuf, zero values are “default values” and have special semantics.

Members

Instances

#toDefault Source

toDefault :: forall a. Default a => Maybe a -> a

Turns 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.

#label Source

label :: forall m s a. Monad m => String -> ParserT s m a -> ParserT s m a

If parsing fails inside this labelled context, then prepend the String to the error String in the ParseError. Use this to establish context for parsing failure error messages.

#fromDefault Source

fromDefault :: forall a. Default a => Eq a => a -> Maybe a

Turns a “default” (zero) value into Nothing.

Re-exports from Protobuf.Internal.Decode

#decodeVarint32 Source

decodeVarint32 :: forall m. MonadEffect m => ParserT DataView m UInt

There 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.

https://developers.google.com/protocol-buffers/docs/encoding#varints

#decodeUint32 Source

#decodeTag32 Source

#decodeSint64 Source

#decodeSint32 Source

#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

#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

#decodeInt32 Source

#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.

#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

#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

#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.

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 Unit

There 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.

https://developers.google.com/protocol-buffers/docs/encoding#varints

#encodeUint64Field Source

#encodeUint64 Source

#encodeUint32Field Source

#encodeUint32 Source

encodeUint32 :: forall m. MonadEffect m => UInt -> PutM m Unit

uint32 Scalar Value Type

#encodeStringField Source

#encodeSint64Field Source

#encodeSint64 Source

#encodeSint32Field Source

#encodeSint32 Source

encodeSint32 :: forall m. MonadEffect m => Int -> PutM m Unit

sint32 Scalar Value Type

#encodeSfixed64Field Source

#encodeSfixed64 Source

encodeSfixed64 :: forall m. MonadEffect m => Int64 -> PutM m Unit

sfixed64 Scalar Value Type

#encodeSfixed32Field Source

#encodeSfixed32 Source

encodeSfixed32 :: forall m. MonadEffect m => Int -> PutM m Unit

sfixed32 Scalar Value Type

#encodeInt64Field Source

#encodeInt64 Source

#encodeInt32Field Source

#encodeInt32 Source

encodeInt32 :: forall m. MonadEffect m => Int -> PutM m Unit

int32 Scalar Value Type

#encodeFloatField Source

#encodeFloat Source

#encodeFixed64Field Source

#encodeFixed64 Source

#encodeFixed32Field Source

#encodeFixed32 Source

encodeFixed32 :: forall m. MonadEffect m => UInt -> PutM m Unit

fixed32 Scalar Value Type

#encodeDoubleField Source

#encodeDouble Source

#encodeBytesField Source

#encodeBuilder Source

encodeBuilder :: forall m. MonadEffect m => FieldNumber -> Builder -> PutM m Unit

tell with a tag and a length delimit.

#encodeBoolField Source

#encodeBool Source

Re-exports from Protobuf.Internal.Runtime

#UnknownField Source

data UnknownField

A message field value from an unknown .proto definition.

See Message Structure for an explanation.

  • UnknownVarInt Use Protobuf.Internal.Decode.decodeZigzag64 to interpret this as a signed integer.
  • UnknownLenDel holds a variable-length Bytes.
  • UnknownBits64 must hold Bytes of length 8.
  • UnknownBits32 must hold Bytes of length 4.

See the modules Protobuf.Internal.Encode and Protobuf.Internal.Decode for ways to operate on the Bytes.

Constructors

Instances

#FieldNumberInt Source

type FieldNumberInt = Int

We 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 => FieldNumberInt -> Array a -> (FieldNumber -> a -> PutM m Unit) -> PutM m Unit

#putPacked Source

putPacked :: forall m a. MonadEffect 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

#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 a

The 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 a

Parse 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

#mergeWith Source

mergeWith :: forall a. (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a

Merge the new left with the old right.

#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

#merge Source

merge :: forall r1 r2 r3 r4. Union r1 r2 r3 => Nub r3 r4 => Record r1 -> Record r2 -> Record r4

Merges two records with the first record's labels taking precedence in the case of overlaps.

For example:

merge { x: 1, y: "y" } { y: 2, z: true }
 :: { x :: Int, y :: String, z :: Boolean }

Re-exports from Record.Builder

#Builder Source

newtype Builder a b

A 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 }

Instances

#modify Source

modify :: forall l a b r r1 r2. Cons l a r r1 => Cons l b r r2 => IsSymbol l => Proxy l -> (a -> b) -> Builder (Record r1) (Record r2)

Build by modifying an existing field.

Re-exports from Type.Proxy

#Proxy Source

data Proxy :: forall k. k -> Typedata Proxy a

Proxy type for all kinds.

Constructors