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

PlutusCore.Flat.Bits

Description

Utilities to represent and display bit sequences

Synopsis

Documentation

type Bits = Vector Bool Source #

A sequence of bits

bits ∷ ∀ a. Flat a ⇒ a → Bits Source #

The sequence of bits corresponding to the serialization of the passed value (without any final byte padding)

>>> bits True
[True]

paddedBits ∷ ∀ a. Flat a ⇒ a → Bits Source #

The sequence of bits corresponding to the byte-padded serialization of the passed value

>>> paddedBits True
[True,False,False,False,False,False,False,True]

asBytesBits → [Word8] Source #

Convert a sequence of bits to the corresponding list of bytes

>>> asBytes $ asBits (256+3::Word16)
[1,3]

asBitsFiniteBits a ⇒ a → Bits Source #

Convert an integral value to its equivalent bit representation

>>> asBits (5::Word8)
[False,False,False,False,False,True,False,True]

Orphan instances

Pretty Bits Source #
>>> prettyShow $ asBits (256+3::Word16)
"00000001 00000011"
Instance details