type-combinators-0.1.2.1: A collection of data types for type-level programming

CopyrightCopyright (C) 2015 Kyle Carter
LicenseBSD3
MaintainerKyle Carter <kylcarte@indiana.edu>
Stabilityexperimental
PortabilityRankNTypes
Safe HaskellNone
LanguageHaskell2010

Type.Family.List

Description

Convenient aliases and type families for working with type-level lists.

Synopsis

Documentation

type Ø = `[]` Source

type (:<) = (:) infixr 5 Source

type Only a = `[a]` Source

Type-level singleton list.

type family as ++ bs :: [k] infixr 5 Source

Appends two type-level lists.

Equations

Ø ++ bs = bs 
(a :< as) ++ bs = a :< (as ++ bs) 

type family as >: a :: [k] infixl 6 Source

Type-level list snoc.

Equations

Ø >: a = Only a 
(b :< as) >: a = b :< (as >: a) 

type family Reverse as :: [k] Source

Equations

Reverse Ø = Ø 
Reverse (a :< as) = Reverse as >: a 

type family Init' a as :: [k] Source

Equations

Init' a Ø = Ø 
Init' a (b :< as) = a :< Init' b as 

type family Last' a as :: k Source

Equations

Last' a Ø = a 
Last' a (b :< as) = Last' b as 

type family ListC cs :: Constraint Source

Takes a type-level list of Constraints to a single Constraint, where ListC cs holds iff all elements of cs hold.

Equations

ListC Ø = ØC 
ListC (c :< cs) = (c, ListC cs) 

type family f <$> a :: [l] infixr 4 Source

Map an (f :: k -> l) over a type-level list (as :: [k]), giving a list (bs :: [l]).

Equations

f <$> Ø = Ø 
f <$> (a :< as) = f a :< (f <$> as) 

type family f <&> a :: [l] infixl 5 Source

Map a list of (fs :: [k -> l]) over a single (a :: k), giving a list (bs :: [l]).

Equations

Ø <&> a = Ø 
(f :< fs) <&> a = f a :< (fs <&> a) 

type family f <*> a :: [l] infixr 4 Source

Equations

fs <*> Ø = Ø 
fs <*> (a :< as) = (fs <&> a) ++ (fs <*> as) 

(==) :: Eq a => a -> a -> Bool