ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Util.SOP

Synopsis

Minor variations on standard SOP operators

data Lens f xs a Source #

Simple lens to access an element of an n-ary product.

Constructors

Lens

Fields

fn_5 :: (f0 a -> f1 a -> f2 a -> f3 a -> f4 a -> f5 a) -> (f0 -.-> (f1 -.-> (f2 -.-> (f3 -.-> (f4 -.-> f5))))) a Source #

lenses_NP :: forall f xs. SListI xs => NP ( Lens f xs) xs Source #

Generate all lenses to access the element of an n-ary product.

map_NP' :: forall f g xs. ( forall a. f a -> g a) -> NP f xs -> NP g xs Source #

Version of map_NP that does not require a singleton

npToSListI :: NP a xs -> ( SListI xs => r) -> r Source #

Conjure up an SListI constraint from an NP

npWithIndices :: SListI xs => NP ( K Word8 ) xs Source #

We only allow up to 23 (so counting from 0, 24 elements in xs ), because CBOR stores a Word8 in the range 0-23 as a single byte equal to the value of the Word8 . We rely on this in reconstructNestedCtxt and other places.

nsFromIndex :: SListI xs => Word8 -> Maybe ( NS ( K ()) xs) Source #

We only allow up to 23, see npWithIndices .

partition_NS :: forall xs f. SListI xs => [ NS f xs] -> NP ([] :.: f) xs Source #

sequence_NS' :: forall xs f g. Functor f => NS (f :.: g) xs -> f ( NS g xs) Source #

Version of sequence_NS that requires only Functor

The version in the library requires Applicative , which is unnecessary.

Type-level non-empty lists

class IsNonEmpty xs where Source #

Instances

Instances details
IsNonEmpty (x ': xs :: [a]) Source #
Instance details

Defined in Ouroboros.Consensus.Util.SOP

Methods

isNonEmpty :: proxy (x ': xs) -> ProofNonEmpty (x ': xs) Source #

data ProofNonEmpty :: [a] -> Type where Source #

Constructors

ProofNonEmpty :: Proxy x -> Proxy xs -> ProofNonEmpty (x ': xs)

Indexing SOP types

data Index xs x where Source #

Constructors

IZ :: Index (x ': xs) x
IS :: Index xs x -> Index (y ': xs) x

injectNS :: forall f x xs. Index xs x -> f x -> NS f xs Source #

injectNS' :: forall f a b x xs. ( Coercible a (f x), Coercible b ( NS f xs)) => Proxy f -> Index xs x -> a -> b Source #

Zipping with indices

hcimap :: ( HAp h, All c xs, Prod h ~ NP ) => proxy c -> ( forall a. c a => Index xs a -> f1 a -> f2 a) -> h f1 xs -> h f2 xs Source #

hcizipWith :: ( HAp h, All c xs, Prod h ~ NP ) => proxy c -> ( forall a. c a => Index xs a -> f1 a -> f2 a -> f3 a) -> NP f1 xs -> h f2 xs -> h f3 xs Source #

hcizipWith3 :: ( HAp h, All c xs, Prod h ~ NP ) => proxy c -> ( forall a. c a => Index xs a -> f1 a -> f2 a -> f3 a -> f4 a) -> NP f1 xs -> NP f2 xs -> h f3 xs -> h f4 xs Source #

hcizipWith4 :: ( HAp h, All c xs, Prod h ~ NP ) => proxy c -> ( forall a. c a => Index xs a -> f1 a -> f2 a -> f3 a -> f4 a -> f5 a) -> NP f1 xs -> NP f2 xs -> NP f3 xs -> h f4 xs -> h f5 xs Source #

himap :: ( HAp h, SListI xs, Prod h ~ NP ) => ( forall a. Index xs a -> f1 a -> f2 a) -> h f1 xs -> h f2 xs Source #

hizipWith :: ( HAp h, SListI xs, Prod h ~ NP ) => ( forall a. Index xs a -> f1 a -> f2 a -> f3 a) -> NP f1 xs -> h f2 xs -> h f3 xs Source #

hizipWith3 :: ( HAp h, SListI xs, Prod h ~ NP ) => ( forall a. Index xs a -> f1 a -> f2 a -> f3 a -> f4 a) -> NP f1 xs -> NP f2 xs -> h f3 xs -> h f4 xs Source #

hizipWith4 :: ( HAp h, SListI xs, Prod h ~ NP ) => ( forall a. Index xs a -> f1 a -> f2 a -> f3 a -> f4 a -> f5 a) -> NP f1 xs -> NP f2 xs -> NP f3 xs -> h f4 xs -> h f5 xs Source #