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

PlutusCore.Flat.Encoder

Description

Encoder and encoding primitives

Synopsis

Documentation

data Encoding #

Instances

Instances details
Monoid Encoding # 
Instance details

Defined in PlutusCore.Flat.Encoder.Strict

Semigroup Encoding # 
Instance details

Defined in PlutusCore.Flat.Encoder.Strict

Show Encoding # 
Instance details

Defined in PlutusCore.Flat.Encoder.Strict

(<>) :: Semigroup a => a -> a -> a infixr 6 #

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 #

Number of bits

mempty :: Monoid a => a #

Identity of mappend

Examples

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

strictEncoder :: NumBits -> Encoding -> ByteString #

Strict encoder

eTrueF :: Prim #

>>> enc eTrueF
"1"

eFalseF :: Prim #

>>> enc eFalseF
"0"

encodeArrayWith :: (t -> Encoding) -> [t] -> Encoding #

Encode as Array

encodeListWith :: (t -> Encoding) -> [t] -> Encoding #

Encode as a List

type Size a = a -> NumBits -> NumBits #

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