type-prelude-0.1: Partial port of prelude to the type level. Requires GHC 7.6.1.

Safe HaskellNone

Prelude.Type.Families

Contents

Description

A prelude for type-level programming with type families

Synopsis

Documentation

module Prelude

type family If p a b :: kSource

If

Type Classes

Show

type Show a = Shows a `[]`Source

type family Shows a t :: [Symbol]Source

Kind

type family Kind a :: *Source

Get kind of a type

Eq

type family a (==) b :: BoolSource

type (/=) a b = Not (a == b)Source

Ord

type family Compare a b :: OrderingSource

type Max a b = FromOrdering b a a (Compare a b)Source

type Min a b = FromOrdering a a b (Compare a b)Source

Enum

type family ToEnum i :: kSource

type family FromEnum a :: IntegerSource

type Succ a = ToEnum (I 1 + FromEnum a)Source

type Pred a = ToEnum (FromEnum a `Minus` I 1)Source

type family EnumFromTo_1 lt a b :: [k]Source

Bounded

type family MinBound :: kSource

type family MaxBound :: kSource

Primitive kinds

Unit

Maybe

Bool

type family Not a :: BoolSource

type family a (||) b :: BoolSource

type family a (&&) b :: BoolSource

Ordering

type family FromOrdering lt eq gt o :: kSource

type family CombineOrdering a b :: OrderingSource

Either

Tuples

type family Fst p :: aSource

type family Snd p :: bSource

Type Literals

Star

data StarKind Source

The Kind *

Predicates/Constraints

type Compose f g a = f (g a)Source

type family a ($) b :: kSource

type Id a = aSource

type Flip f a b = f a bSource

Lists

type family ShowsTail a x :: [Symbol]Source

type family Head l :: kSource

type family Tail l :: [k]Source

type family Last a :: kSource

type family Init a :: [k]Source

type family Null a :: BoolSource

type family Length a :: IntegerSource

type family a (!!) i :: kSource

type family At_1 a b c d :: kSource

type family Drop i a :: [k]Source

type family a (++) b :: [k]Source

type family Concat a :: [k]Source

type family Replicate_1 z i a :: [k]Source

type family And a :: BoolSource

type family Or a :: BoolSource

type family Elem a b :: BoolSource

type family Elem_1 p a b :: BoolSource

type NotElem a b = Not (Elem a b)Source

Integer

type family ShowsInteger_2 z i x :: [Symbol]Source

type family IsZero i :: BoolSource

type family Digit i :: SymbolSource

type family IntegerEqual p i j :: BoolSource

type family IntegerEnd i :: BoolSource

type family a (+) b :: kSource

type family AddWithCarry_2 end a b c :: IntegerSource

type family AddWithCarry_3 h i j :: IntegerSource

type family Add3 a b c :: (Bool, Bool)Source

Two bit sum of three bits Add3 a b c ~ '(sum, carry)

type family Minus a b :: kSource

type family Negate a :: kSource

type family a (*) b :: kSource

type Abs a = FromOrdering (Negate a) a a (Compare0 a)Source

type Subtract a b = b `Minus` aSource

type Odd i = Not (Even i)Source

type family Gcd_1 zs a b :: IntegerSource

type family Gcd_3 z a b :: IntegerSource

type Gcd a b = Gcd_1 (IsZero a && IsZero b) a bSource

type Gcd_2 a b = Gcd_3 (IsZero b) a bSource

type family Compare0 i :: OrderingSource

Misc functions from the Prelude

type Undefined = Error "undefined"Source

type family Error a :: k2Source

type family ERROR a :: k2Source

type family AsKindOf a b :: kSource

Bits

type family Xor a b :: kSource

type family Xor_2 end a b :: kSource

type family a (.&.) b :: kSource

type family BitwiseAnd_2 end a b :: kSource

type family Complement a :: kSource

Integral

type QuotRem a b = `((Signum a * Signum b) * Fst (QuotRem' (Abs a) (Abs b)), Signum a * Snd (QuotRem' (Abs a) (Abs b)))`Source

type family QuotRem'_2 p a b :: (Integer, Integer)Source

type family QuotRem'_3 b qr :: (Integer, Integer)Source

type family QuotRem'_4 p a b c :: (Integer, Integer)Source

type QuotRem' a b = QuotRem'_2 (a < b) a bSource

type Rem a b = Snd (QuotRem a b)Source

type Quot a b = Fst (QuotRem a b)Source