plutus-core-1.54.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Flat.Encoder

Description

Encoder and encoding primitives

Synopsis

Documentation

(<>)Semigroup a ⇒ a → a → a infixr 6 Source #

An associative operation.

Examples

Expand
>>> [1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
>>> Just [1, 2, 3] <> Just [4, 5, 6]
Just [1,2,3,4,5,6]
>>> putStr "Hello, " <> putStrLn "World!"
Hello, World!

type NumBits = Int Source #

Number of bits

memptyMonoid a ⇒ a Source #

Identity of mappend

Examples

Expand
>>> "Hello world" <> mempty
"Hello world"
>>> mempty <> [1, 2, 3]
[1,2,3]

strictEncoderNumBitsEncodingByteString Source #

Strict encoder

eTrueFPrim Source #

>>> enc eTrueF
"1"

eFalseFPrim Source #

>>> enc eFalseF
"0"

encodeArrayWith ∷ (t → Encoding) → [t] → Encoding Source #

Encode as Array

encodeListWith ∷ (t → Encoding) → [t] → Encoding Source #

Encode as a List

type Size a = a → NumBitsNumBits Source #

Add the maximum size in bits of the encoding of value a to a NumBits