ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Util.HList

Description

Heterogeneous lists

Intended for qualified import

Synopsis

Basic definitions

data HList :: [Type] -> Type where Source #

Constructors

Nil :: HList '[] 
(:*) :: a -> HList as -> HList (a ': as) infixr 9 

Instances

Instances details
(IsList as, All Eq as) => Eq (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

(==) :: HList as -> HList as -> Bool #

(/=) :: HList as -> HList as -> Bool #

(IsList as, All Eq as, All Ord as) => Ord (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

compare :: HList as -> HList as -> Ordering #

(<) :: HList as -> HList as -> Bool #

(<=) :: HList as -> HList as -> Bool #

(>) :: HList as -> HList as -> Bool #

(>=) :: HList as -> HList as -> Bool #

max :: HList as -> HList as -> HList as #

min :: HList as -> HList as -> HList as #

All Show as => Show (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

showsPrec :: Int -> HList as -> ShowS #

show :: HList as -> String #

showList :: [HList as] -> ShowS #

All Condense as => Condense (HList as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.Condense

Methods

condense :: HList as -> String Source #

type family All c as :: Constraint where ... Source #

Equations

All c '[] = () 
All c (a ': as) = (c a, All c as) 

Folding

foldl :: forall c as b proxy. All c as => proxy c -> (forall a. c a => b -> a -> b) -> b -> HList as -> b Source #

foldlM :: forall c as m b proxy. (All c as, Monad m) => proxy c -> (forall a. c a => b -> a -> m b) -> b -> HList as -> m b Source #

foldr :: forall c as b proxy. All c as => proxy c -> (forall a. c a => a -> b -> b) -> b -> HList as -> b Source #

foldMap :: forall c as b proxy. (All c as, Monoid b) => proxy c -> (forall a. c a => a -> b) -> HList as -> b Source #

repeatedly :: forall c as b proxy. All c as => proxy c -> (forall a. c a => a -> b -> b) -> HList as -> b -> b Source #

Apply function repeatedly for all elements of the list

repeatedly p = flip . foldl p . flip

repeatedlyM :: forall c as b proxy m. (Monad m, All c as) => proxy c -> (forall a. c a => a -> b -> m b) -> HList as -> b -> m b Source #

collapse :: forall c as b proxy. All c as => proxy c -> (forall a. c a => a -> b) -> HList as -> [b] Source #

Singletons

data SList :: [Type] -> Type Source #

class IsList (xs :: [Type]) where Source #

Methods

isList :: SList xs Source #

Instances

Instances details
IsList ('[] :: [Type]) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

isList :: SList '[] Source #

IsList as => IsList (a ': as) Source # 
Instance details

Defined in Ouroboros.Consensus.Util.HList

Methods

isList :: SList (a ': as) Source #

n-ary functions

type family Fn as b where ... Source #

Equations

Fn '[] b = b 
Fn (a ': as) b = a -> Fn as b 

applyFn :: Fn as b -> HList as -> b Source #

afterFn :: SList as -> (b -> c) -> Fn as b -> Fn as c Source #