singletons-2.4.1: A framework for generating singleton types

Copyright(C) 2013-2014 Richard Eisenberg Jan Stolarek
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (rae@cs.brynmawr.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 :: k) Source #

The singleton kind-indexed data family.

Instances
SDecide k => TestCoercion (Sing :: k -> *) # 
Instance details

Defined in Data.Singletons.Decide

Methods

testCoercion :: Sing a -> Sing b -> Maybe (Coercion a b) #

SDecide k => TestEquality (Sing :: k -> *) # 
Instance details

Defined in Data.Singletons.Decide

Methods

testEquality :: Sing a -> Sing b -> Maybe (a :~: b) #

Show (SSymbol s) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> SSymbol s -> ShowS #

show :: SSymbol s -> String #

showList :: [SSymbol s] -> ShowS #

Show (SNat n) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> SNat n -> ShowS #

show :: SNat n -> String #

showList :: [SNat n] -> ShowS #

Eq (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

(==) :: Sing a -> Sing a -> Bool #

(/=) :: Sing a -> Sing a -> Bool #

Ord (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

compare :: Sing a -> Sing a -> Ordering #

(<) :: Sing a -> Sing a -> Bool #

(<=) :: Sing a -> Sing a -> Bool #

(>) :: Sing a -> Sing a -> Bool #

(>=) :: Sing a -> Sing a -> Bool #

max :: Sing a -> Sing a -> Sing a #

min :: Sing a -> Sing a -> Sing a #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing [a]) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

ShowSing a => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

showsPrec :: Int -> Sing a -> ShowS #

show :: Sing a -> String #

showList :: [Sing a] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e, ShowSing f) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e, ShowSing f, ShowSing g) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing [a]) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

data Sing (z :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Bool) where
data Sing (z :: Ordering) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Ordering) where
data Sing (a :: Type) Source # 
Instance details

Defined in Data.Singletons.TypeRepStar

data Sing (a :: Type) = STypeRep (TypeRep a)
data Sing (n :: Nat) Source # 
Instance details

Defined in Data.Singletons.TypeLits.Internal

data Sing (n :: Nat) where
data Sing (n :: Symbol) Source # 
Instance details

Defined in Data.Singletons.TypeLits.Internal

data Sing (n :: Symbol) where
data Sing (z :: ()) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: ()) where
data Sing (z :: Void) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Void)
data Sing (z :: [a]) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: [a]) where
data Sing (z :: Maybe a) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Maybe a) where
data Sing (z :: NonEmpty a) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: NonEmpty a) where
data Sing (z :: Either a b) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Either a b) where
data Sing (z :: (a, b)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b)) where
data Sing (f :: k1 ~> k2) Source # 
Instance details

Defined in Data.Singletons.Internal

data Sing (f :: k1 ~> k2) = SLambda {}
data Sing (z :: (a, b, c)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c)) where
data Sing (z :: (a, b, c, d)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d)) where
data Sing (z :: (a, b, c, d, e)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d, e)) where
data Sing (z :: (a, b, c, d, e, f)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d, e, f)) where
data Sing (z :: (a, b, c, d, e, f, g)) Source # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d, e, f, g)) where

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

SFalse :: Sing False
STrue  :: Sing True

type SBool = (Sing :: Bool -> Type) Source #

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

Conditionals

type family If (cond :: Bool) (tru :: k) (fls :: k) :: k where ... #

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

Equations

If True (tru :: k) (fls :: k) = tru 
If False (tru :: k) (fls :: k) = 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) = (res :: Bool) | res -> a where ... #

Type-level "not". An injective type family since 4.10.0.0.

Since: base-4.7.0.0

Equations

Not False = True 
Not True = False 

sNot :: Sing a -> Sing (Not a) Source #

Negation of a singleton

type family (a :: Bool) && (b :: Bool) :: Bool where ... infixr 3 #

Type-level "and"

Equations

False && a = False 
True && a = a 
a && False = False 
a && True = a 
a && a = a 

type family (a :: Bool) || (b :: Bool) :: Bool where ... infixr 2 #

Type-level "or"

Equations

False || a = a 
True || a = True 
a || False = a 
a || True = True 
a || a = a 

(%&&) :: Sing a -> Sing b -> Sing (a && b) infixr 3 Source #

Conjunction of singletons

(%||) :: Sing a -> Sing b -> Sing (a || b) infixr 2 Source #

Disjunction of singletons

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

bool_ :: a -> a -> Bool -> a Source #

type family Bool_ (a :: a) (a :: a) (a :: Bool) :: a where ... Source #

Equations

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

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

type family Otherwise :: Bool where ... Source #

Equations

Otherwise = TrueSym0 

Defunctionalization symbols

data NotSym0 (l :: TyFun Bool Bool) Source #

Instances
SuppressUnusedWarnings NotSym0 Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply NotSym0 (l :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply NotSym0 (l :: Bool) = Not l

type NotSym1 (t :: Bool) = Not t Source #

data (&&@#@$) (l :: TyFun Bool (TyFun Bool Bool -> Type)) Source #

Instances
SuppressUnusedWarnings (&&@#@$) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (&&@#@$) (l :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (&&@#@$) (l :: Bool) = (&&@#@$$) l

data (l :: Bool) &&@#@$$ (l :: TyFun Bool Bool) Source #

Instances
SuppressUnusedWarnings (&&@#@$$) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply ((&&@#@$$) l1 :: TyFun Bool Bool -> *) (l2 :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply ((&&@#@$$) l1 :: TyFun Bool Bool -> *) (l2 :: Bool) = l1 && l2

type (&&@#@$$$) (t :: Bool) (t :: Bool) = (&&) t t Source #

data (||@#@$) (l :: TyFun Bool (TyFun Bool Bool -> Type)) Source #

Instances
SuppressUnusedWarnings (||@#@$) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (||@#@$) (l :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (||@#@$) (l :: Bool) = (||@#@$$) l

data (l :: Bool) ||@#@$$ (l :: TyFun Bool Bool) Source #

Instances
SuppressUnusedWarnings (||@#@$$) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply ((||@#@$$) l1 :: TyFun Bool Bool -> *) (l2 :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply ((||@#@$$) l1 :: TyFun Bool Bool -> *) (l2 :: Bool) = l1 || l2

type (||@#@$$$) (t :: Bool) (t :: Bool) = (||) t t Source #

data Bool_Sym0 (l :: TyFun a6989586621679308852 (TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> Type)) Source #

Instances
SuppressUnusedWarnings (Bool_Sym0 :: TyFun a6989586621679308852 (TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> Type) -> *) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym0 :: TyFun a6989586621679308852 (TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> Type) -> *) (l :: a6989586621679308852) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym0 :: TyFun a6989586621679308852 (TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> Type) -> *) (l :: a6989586621679308852) = Bool_Sym1 l

data Bool_Sym1 (l :: a6989586621679308852) (l :: TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type)) Source #

Instances
SuppressUnusedWarnings (Bool_Sym1 :: a6989586621679308852 -> TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> *) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym1 l1 :: TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> *) (l2 :: a6989586621679308852) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym1 l1 :: TyFun a6989586621679308852 (TyFun Bool a6989586621679308852 -> Type) -> *) (l2 :: a6989586621679308852) = Bool_Sym2 l1 l2

data Bool_Sym2 (l :: a6989586621679308852) (l :: a6989586621679308852) (l :: TyFun Bool a6989586621679308852) Source #

Instances
SuppressUnusedWarnings (Bool_Sym2 :: a6989586621679308852 -> a6989586621679308852 -> TyFun Bool a6989586621679308852 -> *) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym2 l1 l2 :: TyFun Bool a -> *) (l3 :: Bool) Source # 
Instance details

Defined in Data.Singletons.Prelude.Bool

type Apply (Bool_Sym2 l1 l2 :: TyFun Bool a -> *) (l3 :: Bool) = Bool_ l1 l2 l3

type Bool_Sym3 (t :: a6989586621679308852) (t :: a6989586621679308852) (t :: Bool) = Bool_ t t t Source #