Description

Heterogeneous list utils

Synopsis

Documentation

data family HList (l :: [*]) infixr 2 Source #

Heterogeneous list

Instances
 (Eq x, Eq (HList xs)) => Eq (HList (x ': xs)) Source # Instance detailsDefined in Haskus.Utils.HList Methods(==) :: HList (x ': xs) -> HList (x ': xs) -> Bool #(/=) :: HList (x ': xs) -> HList (x ': xs) -> Bool # Eq (HList ([] :: [Type])) Source # Instance detailsDefined in Haskus.Utils.HList Methods(==) :: HList [] -> HList [] -> Bool #(/=) :: HList [] -> HList [] -> Bool # (Ord x, Ord (HList xs)) => Ord (HList (x ': xs)) Source # Instance detailsDefined in Haskus.Utils.HList Methodscompare :: HList (x ': xs) -> HList (x ': xs) -> Ordering #(<) :: HList (x ': xs) -> HList (x ': xs) -> Bool #(<=) :: HList (x ': xs) -> HList (x ': xs) -> Bool #(>) :: HList (x ': xs) -> HList (x ': xs) -> Bool #(>=) :: HList (x ': xs) -> HList (x ': xs) -> Bool #max :: HList (x ': xs) -> HList (x ': xs) -> HList (x ': xs) #min :: HList (x ': xs) -> HList (x ': xs) -> HList (x ': xs) # Ord (HList ([] :: [Type])) Source # Instance detailsDefined in Haskus.Utils.HList Methodscompare :: HList [] -> HList [] -> Ordering #(<) :: HList [] -> HList [] -> Bool #(<=) :: HList [] -> HList [] -> Bool #(>) :: HList [] -> HList [] -> Bool #(>=) :: HList [] -> HList [] -> Bool #max :: HList [] -> HList [] -> HList [] #min :: HList [] -> HList [] -> HList [] # (Show e, Show (HList l)) => Show (HList (e ': l)) Source # Instance detailsDefined in Haskus.Utils.HList MethodsshowsPrec :: Int -> HList (e ': l) -> ShowS #show :: HList (e ': l) -> String #showList :: [HList (e ': l)] -> ShowS # Show (HList ([] :: [Type])) Source # Instance detailsDefined in Haskus.Utils.HList MethodsshowsPrec :: Int -> HList [] -> ShowS #show :: HList [] -> String #showList :: [HList []] -> ShowS # data HList ([] :: [Type]) Source # Instance detailsDefined in Haskus.Utils.HList data HList ([] :: [Type]) = HNil data HList (x ': xs) Source # Instance detailsDefined in Haskus.Utils.HList data HList (x ': xs) = x HCons (HList xs)

hHead :: HList (e ': l) -> e Source #

hTail :: HList (e ': l) -> HList l Source #

Tail

hLength :: forall xs. KnownNat (Length xs) => HList xs -> Word Source #

Length

hAppend :: HAppendList l1 l2 => HList l1 -> HList l2 -> HList (Concat l1 l2) Source #

class HFoldr' f v (l :: [*]) r where Source #

Like HFoldr but only use types, not values!

It allows us to foldr over a list of types, without any associated hlist of values.

Methods

hFoldr' :: f -> v -> HList l -> r Source #

Instances
 v ~ v' => HFoldr' f v ([] :: [Type]) v' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldr' :: f -> v -> HList [] -> v' Source # (Apply f (e, r) r', HFoldr' f v l r) => HFoldr' f v (e ': l) r' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldr' :: f -> v -> HList (e ': l) -> r' Source #

class HFoldl' f (z :: *) xs (r :: *) where Source #

Like HFoldl but only use types, not values!

It allows us to foldl over a list of types, without any associated hlist of values.

Methods

hFoldl' :: f -> z -> HList xs -> r Source #

Instances
 z ~ z' => HFoldl' f z ([] :: [Type]) z' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldl' :: f -> z -> HList [] -> z' Source # (zx ~ (z, x), Apply f zx z', HFoldl' f z' xs r) => HFoldl' f z (x ': xs) r Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldl' :: f -> z -> HList (x ': xs) -> r Source #

class HTuple' v t | v -> t, t -> v where Source #

Convert between hlists and tuples

Methods

hToTuple' :: HList v -> t Source #

Convert an heterogeneous list into a tuple

hFromTuple' :: t -> HList v Source #

Convert a tuple into an heterogeneous list

Instances

class Apply f a b where Source #

Apply the function identified by the data type f from type a to type b.

Methods

apply :: f -> a -> b Source #

class HZipList x y l | x y -> l, l -> x y Source #

Minimal complete definition

hZipList, hUnzipList

Instances
 HZipList ([] :: [Type]) ([] :: [Type]) ([] :: [Type]) Source # Instance detailsDefined in Haskus.Utils.HList MethodshZipList :: HList [] -> HList [] -> HList [] Source #hUnzipList :: HList [] -> (HList [], HList []) ((x, y) ~ z, HZipList xs ys zs) => HZipList (x ': xs) (y ': ys) (z ': zs) Source # Instance detailsDefined in Haskus.Utils.HList MethodshZipList :: HList (x ': xs) -> HList (y ': ys) -> HList (z ': zs) Source #hUnzipList :: HList (z ': zs) -> (HList (x ': xs), HList (y ': ys))

hZipList :: HZipList x y l => HList x -> HList y -> HList l Source #

class HFoldr f v (l :: [*]) r Source #

Minimal complete definition

hFoldr

Instances
 v ~ v' => HFoldr f v ([] :: [Type]) v' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldr :: f -> v -> HList [] -> v' Source # (Apply f (e, r) r', HFoldr f v l r) => HFoldr f v (e ': l) r' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldr :: f -> v -> HList (e ': l) -> r' Source #

hFoldr :: HFoldr f v l r => f -> v -> HList l -> r Source #

class HFoldl f (z :: *) xs (r :: *) Source #

Minimal complete definition

hFoldl

Instances
 z ~ z' => HFoldl f z ([] :: [Type]) z' Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldl :: f -> z -> HList [] -> z' Source # (zx ~ (z, x), Apply f zx z', HFoldl f z' xs r) => HFoldl f z (x ': xs) r Source # Instance detailsDefined in Haskus.Utils.HList MethodshFoldl :: f -> z -> HList (x ': xs) -> r Source #

hFoldl :: HFoldl f z xs r => f -> z -> HList xs -> r Source #

class HReverse xs sx | xs -> sx, sx -> xs where Source #

Methods

hReverse :: HList xs -> HList sx Source #

Instances
 (HRevApp xs ([] :: [Type]) sx, HRevApp sx ([] :: [Type]) xs) => HReverse xs sx Source # Instance detailsDefined in Haskus.Utils.HList MethodshReverse :: HList xs -> HList sx Source #