singletons-1.0: A framework for generating singleton types

Copyright(C) 2013-2014 Richard Eisenberg, Jan Stolarek
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (eir@cis.upenn.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Singletons.Prelude.Bool

Contents

Description

Defines functions and datatypes relating to the singleton for Bool, including a singletons version of all the definitions in Data.Bool.

Because many of these definitions are produced by Template Haskell, it is not possible to create proper Haddock documentation. Please look up the corresponding operation in Data.Bool. Also, please excuse the apparent repeated variable names. This is due to an interaction between Template Haskell and Haddock.

Synopsis

The Bool singleton

data family Sing a Source

The singleton kind-indexed data family.

Instances

TestCoercion * (Sing *) 
SDecide k (KProxy k) => TestEquality k (Sing k) 
data Sing Bool where 
data Sing Ordering where 
data Sing * where 
data Sing Nat where 
data Sing Symbol where 
data Sing () where 
data Sing [a0] where 
data Sing (Maybe a0) where 
data Sing (TyFun k1 k2 -> *) = SLambda {} 
data Sing (Either a0 b0) where 
data Sing ((,) a0 b0) where 
data Sing ((,,) a0 b0 c0) where 
data Sing ((,,,) a0 b0 c0 d0) where 
data Sing ((,,,,) a0 b0 c0 d0 e0) where 
data Sing ((,,,,,) a0 b0 c0 d0 e0 f0) where 
data Sing ((,,,,,,) a0 b0 c0 d0 e0 f0 g0) where 

Though Haddock doesn't show it, the Sing instance above declares constructors

SFalse :: Sing False
STrue  :: Sing True

type SBool z = Sing z Source

SBool is a kind-restricted synonym for Sing: type SBool (a :: Bool) = Sing a

Conditionals

type family If cond tru fls :: k

Type-level If. If True a b ==> a; If False a b ==> b

Equations

If k True tru fls = tru 
If k False tru fls = fls 

sIf :: Sing a -> Sing b -> Sing c -> Sing (If a b c) Source

Conditional over singletons

Singletons from Data.Bool

type family Not a :: Bool Source

sNot :: forall t. Sing t -> Sing (Apply NotSym0 t) Source

type family a :&& a :: Bool Source

Equations

False :&& z = FalseSym0 
True :&& x = x 

type family a :|| a :: Bool Source

Equations

False :|| x = x 
True :|| z = TrueSym0 

(%:&&) :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply (:&&$) t) t) Source

(%:||) :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply (:||$) t) t) Source

The following are derived from the function bool in Data.Bool. The extra underscore is to avoid name clashes with the type Bool.

bool_ :: forall a. a -> a -> Bool -> a Source

type family Bool_ a a a :: a Source

Equations

Bool_ fls _tru False = fls 
Bool_ _fls tru True = tru 

sBool_ :: forall t t t. Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Bool_Sym0 t) t) t) Source

Defunctionalization symbols

type NotSym1 t = Not t Source

data (:&&$) l Source

Instances

data l :&&$$ l Source

Instances

type (:&&$$$) t t = (:&&) t t Source

data (:||$) l Source

Instances

data l :||$$ l Source

Instances

type (:||$$$) t t = (:||) t t Source

data Bool_Sym0 l Source

Instances

SuppressUnusedWarnings (TyFun k (TyFun k (TyFun Bool k -> *) -> *) -> *) (Bool_Sym0 k) 
type Apply (TyFun k (TyFun Bool k -> *) -> *) k (Bool_Sym0 k) l0 = Bool_Sym1 k l0 

data Bool_Sym1 l l Source

Instances

SuppressUnusedWarnings (k -> TyFun k (TyFun Bool k -> *) -> *) (Bool_Sym1 k) 
type Apply (TyFun Bool k -> *) k (Bool_Sym1 k l1) l0 = Bool_Sym2 k l1 l0 

data Bool_Sym2 l l l Source

Instances

SuppressUnusedWarnings (k -> k -> TyFun Bool k -> *) (Bool_Sym2 k) 
type Apply k Bool (Bool_Sym2 k l1 l2) l0 = Bool_Sym3 k l1 l2 l0 

type Bool_Sym3 t t t = Bool_ t t t Source