Safe Haskell | None |
---|---|
Language | Haskell98 |
- data HList :: [*] -> * where
- class HLength xs where
- class List2HList x xs where
- list2hlist :: [x] -> HList (x : xs)
- class HList2List xs a | xs -> a where
- hlist2list :: xs -> [a]
- class HTake1 n xs1 xs2 | n xs1 -> xs2 where
- htake1 :: n -> xs1 -> xs2
- class HDrop1 n xs1 xs2 | n xs1 -> xs2 where
- hdrop1 :: n -> xs1 -> xs2
- class TypeList t where
- class ConstraintBox box a where
- box :: a -> box
- unsafeUnbox :: box -> a
- class Downcast h box where
- downcast :: h -> [box]
- downcastAs :: (a -> box) -> h -> [box]
- data ShowBox = forall a . Show a => ShowBox !a
- data AnyBox = forall a . AnyBox !a
- type family HCons x xs :: *
- type family UnHList xs :: [a]
- type family HAppend xs ys :: *
- type family Distribute xs t :: [b]
- type family Replicate n x :: [a]
- type family Map f xs :: [a]
- type family Reverse xs :: [a]
- type family xs :! i :: a
- type family Index xs i :: a
- type family xs ++ ys :: [a]
- type family Concat xs :: [a]
- type family Length xs :: Nat
- type family Length1 xs :: Nat1
- data Nat1
- data Nat1Box n = Nat1Box
- type family ToNat1 n :: Nat1
- type family FromNat1 n :: Nat
Heterogenous List
data HList :: [*] -> * where Source
The heterogenous list
(Eq x, Eq (HList xs)) => Eq (HList ((:) * x xs)) | |
Eq (HList ([] *)) | |
(Ord x, Ord (HList xs)) => Ord (HList ((:) * x xs)) | |
Ord (HList ([] *)) | |
(Show x, Show (HList xs)) => Show (HList ((:) * x xs)) | |
Show (HList ([] *)) | |
(Monoid x, Monoid (HList xs)) => Monoid (HList ((:) * x xs)) | |
Monoid (HList ([] *)) | |
HLength (HList xs) => HLength (HList ((:) * x xs)) | |
HLength (HList ([] *)) | |
(TypeList (HList xs), Typeable * x) => TypeList (HList ((:) * x xs)) | |
TypeList (HList ([] *)) | |
(ConstraintBox box x, Downcast (HList xs) box) => Downcast (HList ((:) * x xs)) box | |
Downcast (HList ([] *)) a | |
HList2List (HList xs) a => HList2List (HList ((:) * a xs)) a | |
HList2List (HList ((:) * a ([] *))) a | |
HTake1 (Nat1Box n) (HList xs1) (HList xs2) => HTake1 (Nat1Box (Succ n)) (HList ((:) * x xs1)) (HList ((:) * x xs2)) | |
HTake1 (Nat1Box Zero) (HList xs1) (HList ([] *)) | |
HDrop1 (Nat1Box n) (HList xs1) (HList xs2) => HDrop1 (Nat1Box (Succ n)) (HList ((:) * x xs1)) (HList xs2) | |
HDrop1 (Nat1Box Zero) (HList xs1) (HList xs1) | |
type UnHList * (HList xs) = xs | |
type HCons x (HList xs) = HList ((:) * x xs) | |
type HAppend (HList xs) (HList ys) = HList ((++) * xs ys) |
Used only for the HList class to determine its length
class List2HList x xs where Source
For construction from lists
list2hlist :: [x] -> HList (x : xs) Source
List2HList x ([] *) | |
List2HList x xs => List2HList x ((:) * x xs) |
class HList2List xs a | xs -> a where Source
For converting into a list
hlist2list :: xs -> [a] Source
HList2List (HList xs) a => HList2List (HList ((:) * a xs)) a | |
HList2List (HList ((:) * a ([] *))) a |
Typeable
Downcasting
class ConstraintBox box a where Source
unsafeUnbox :: box -> a Source
Show a => ConstraintBox ShowBox a |
class Downcast h box where Source
downcastAs :: (a -> box) -> h -> [box] Source
Boxes
Use this box unless you know for certain that your types won't have a show instance.
Show ShowBox | |
Show a => ConstraintBox ShowBox a |
Type functions
HList
Type Lists
type family Distribute xs t :: [b] Source
type Distribute k k1 ([] (k1 -> k)) a = [] k | |
type Distribute k k1 ((:) (k1 -> k) x xs) a = (:) k (x a) (Distribute k k1 xs a) |
Type Nats
HTake1 (Nat1Box n) (HList xs1) (HList xs2) => HTake1 (Nat1Box (Succ n)) (HList ((:) * x xs1)) (HList ((:) * x xs2)) | |
HTake1 (Nat1Box Zero) (HList xs1) (HList ([] *)) | |
HDrop1 (Nat1Box n) (HList xs1) (HList xs2) => HDrop1 (Nat1Box (Succ n)) (HList ((:) * x xs1)) (HList xs2) | |
HDrop1 (Nat1Box Zero) (HList xs1) (HList xs1) |
type family ToNat1 n :: Nat1 Source
type ToNat1 0 = Zero | |
type ToNat1 1 = Succ (ToNat1 0) | |
type ToNat1 2 = Succ (ToNat1 1) | |
type ToNat1 3 = Succ (ToNat1 2) | |
type ToNat1 4 = Succ (ToNat1 3) | |
type ToNat1 5 = Succ (ToNat1 4) | |
type ToNat1 6 = Succ (ToNat1 5) | |
type ToNat1 7 = Succ (ToNat1 6) | |
type ToNat1 8 = Succ (ToNat1 7) | |
type ToNat1 9 = Succ (ToNat1 8) | |
type ToNat1 10 = Succ (ToNat1 9) | |
type ToNat1 11 = Succ (ToNat1 10) | |
type ToNat1 12 = Succ (ToNat1 11) | |
type ToNat1 13 = Succ (ToNat1 12) | |
type ToNat1 14 = Succ (ToNat1 13) | |
type ToNat1 15 = Succ (ToNat1 14) | |
type ToNat1 16 = Succ (ToNat1 15) | |
type ToNat1 17 = Succ (ToNat1 16) | |
type ToNat1 18 = Succ (ToNat1 17) | |
type ToNat1 19 = Succ (ToNat1 18) | |
type ToNat1 20 = Succ (ToNat1 19) |
type family FromNat1 n :: Nat Source
type FromNat1 Zero = 0 | |
type FromNat1 (Succ (Succ (Succ (Succ (Succ (Succ Zero)))))) = 6 | |
type FromNat1 (Succ (Succ (Succ (Succ (Succ Zero))))) = 5 | |
type FromNat1 (Succ (Succ (Succ (Succ Zero)))) = 4 | |
type FromNat1 (Succ (Succ (Succ Zero))) = 3 | |
type FromNat1 (Succ (Succ Zero)) = 2 | |
type FromNat1 (Succ Zero) = 1 |