Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Utils for type lists
Synopsis
- type family Map (f :: a -> k) (xs :: [a]) :: [k] where ...
- type family Max (xs :: [Nat]) where ...
- type family Tail (xs :: [k]) :: [k] where ...
- type family Drop (n :: Nat) (xs :: [k]) :: [k] where ...
- type family Take (n :: Nat) (xs :: [k]) :: [k] where ...
- type family Init (xs :: [k]) :: [k] where ...
- type family Head (xs :: [k]) :: k where ...
- type family Snoc (xs :: [k]) (x :: k) :: [k] where ...
- type family InsertAt (n :: Nat) (l :: [k]) (l2 :: [k]) :: [k] where ...
- type family ReplaceAt (n :: Nat) (l :: [k]) (l2 :: [k]) :: [k] where ...
- type family Replace (t1 :: k) (t2 :: k) (l :: [k]) :: [k] where ...
- type family ReplaceN (n :: Nat) (t :: k) (l :: [k]) :: [k] where ...
- type family ReplaceNS (ns :: [Nat]) (t :: k) (l :: [k]) :: [k] where ...
- type family Reverse (l :: [k]) :: [k] where ...
- type family RemoveAt (n :: Nat) (l :: [k]) :: [k] where ...
- type family RemoveAt1 (n :: Nat) (l :: [k]) :: [k] where ...
- type family RemoveAtN (ns :: [Nat]) (l :: [k]) :: [k] where ...
- type family Concat (xs :: [k]) (ys :: [k]) :: [k] where ...
- type family Length (xs :: [k]) :: Nat where ...
- type family Replicate (n :: Nat) (s :: k) :: [k] where ...
- type family Generate (n :: Nat) (m :: Nat) :: [Nat] where ...
- type family IsMember (a :: k) (l :: [k]) :: Bool where ...
- type family IsSubset (l1 :: [k]) (l2 :: [k]) :: Bool where ...
- type family Indexes (l :: [k]) :: [Nat] where ...
- type family MapTest (a :: k) (l :: [k]) :: [Nat] where ...
- type family Zip (l :: [*]) (l2 :: [*]) where ...
- type family Filter (a :: k) (l :: [k]) :: [k] where ...
- type family Nub (l :: [k]) :: [k] where ...
- type family NubHead (l :: [k]) :: [k] where ...
- type family IndexOf (a :: k) (l :: [k]) :: Nat where ...
- type family IndexesOf (a :: k) (l :: [k]) :: [Nat] where ...
- type family MaybeIndexOf (a :: k) (l :: [k]) where ...
- type family Index (n :: Nat) (l :: [k]) :: k where ...
- type family Union (xs :: [k]) (ys :: [k]) :: [k] where ...
- type family Product (xs :: [*]) (ys :: [*]) :: [*] where ...
- type Member x xs = (IsMember x xs ~ True, x ~ Index (IndexOf x xs) xs, KnownNat (IndexOf x xs))
- type Member' x xs = (x ~ Index (IndexOf x xs) xs, KnownNat (IndexOf x xs))
- type CheckNub (l :: [k]) = CheckNubEx l (Nub l) ~ True
Documentation
type family Max (xs :: [Nat]) where ... Source #
Get the max of a list of Nats
Max (x ': xs) = Max' x xs |
type family ReplaceAt (n :: Nat) (l :: [k]) (l2 :: [k]) :: [k] where ... Source #
replace l[n] with l2 (folded)
type family Replace (t1 :: k) (t2 :: k) (l :: [k]) :: [k] where ... Source #
replace a type by another in l
type family ReplaceN (n :: Nat) (t :: k) (l :: [k]) :: [k] where ... Source #
replace a type at offset n in l
type family ReplaceNS (ns :: [Nat]) (t :: k) (l :: [k]) :: [k] where ... Source #
replace types at offsets ns in l
type family RemoveAt1 (n :: Nat) (l :: [k]) :: [k] where ... Source #
Remove a type at index (0 == don't remove)
type family RemoveAtN (ns :: [Nat]) (l :: [k]) :: [k] where ... Source #
Remove types at several indexes
type family Replicate (n :: Nat) (s :: k) :: [k] where ... Source #
Replicate
Replicate n s = Replicate' s n '[] |
type family Generate (n :: Nat) (m :: Nat) :: [Nat] where ... Source #
Generate a list of Nat [n..m-1]
type family IsMember (a :: k) (l :: [k]) :: Bool where ... Source #
Check that a type is member of a type list
IsMember a l = IsMember' l a l |
type family IsSubset (l1 :: [k]) (l2 :: [k]) :: Bool where ... Source #
Check that a list is a subset of another
type family Indexes (l :: [k]) :: [Nat] where ... Source #
Get list indexes
Indexes xs = IndexesFrom 0 xs |
type family MapTest (a :: k) (l :: [k]) :: [Nat] where ... Source #
Map to 1 if type equality, 0 otherwise
type family IndexOf (a :: k) (l :: [k]) :: Nat where ... Source #
Get the first index of a type
IndexOf x xs = IndexOf' x xs xs |
type family IndexesOf (a :: k) (l :: [k]) :: [Nat] where ... Source #
Get all the indexes of a type
IndexesOf x xs = IndexesOf' 0 x xs |
type family MaybeIndexOf (a :: k) (l :: [k]) where ... Source #
Get the first index (starting from 1) of a type or 0 if none
MaybeIndexOf x xs = MaybeIndexOf' 0 x xs |
type Member x xs = (IsMember x xs ~ True, x ~ Index (IndexOf x xs) xs, KnownNat (IndexOf x xs)) Source #
Constraint: x member of xs