singletons-2.3.1: A framework for generating singleton types

Copyright(C) 2014 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (rae@cs.brynmawr.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Singletons.TypeLits

Contents

Description

Defines and exports singletons useful for the Nat and Symbol kinds.

Synopsis

Documentation

data Nat :: * #

(Kind) This is the kind of type-level natural numbers.

Instances

SNum Nat # 
PNum Nat # 

Associated Types

type (Nat :+ (arg :: Nat)) (arg :: Nat) :: a #

type (Nat :- (arg :: Nat)) (arg :: Nat) :: a #

type (Nat :* (arg :: Nat)) (arg :: Nat) :: a #

type Negate Nat (arg :: Nat) :: a #

type Abs Nat (arg :: Nat) :: a #

type Signum Nat (arg :: Nat) :: a #

type FromInteger Nat (arg :: Nat) :: a #

SEnum Nat # 
PEnum Nat # 

Associated Types

type Succ Nat (arg :: Nat) :: a #

type Pred Nat (arg :: Nat) :: a #

type ToEnum Nat (arg :: Nat) :: a #

type FromEnum Nat (arg :: Nat) :: Nat #

type EnumFromTo Nat (arg :: Nat) (arg :: Nat) :: [a] #

type EnumFromThenTo Nat (arg :: Nat) (arg :: Nat) (arg :: Nat) :: [a] #

SuppressUnusedWarnings (Nat -> TyFun Nat Nat -> *) (:^$$) # 
SuppressUnusedWarnings (TyFun Nat (TyFun Nat Nat -> *) -> *) (:^$) # 
SuppressUnusedWarnings (TyFun Nat Constraint -> *) KnownNatSym0 # 
SuppressUnusedWarnings ((TyFun a1627856109 Bool -> Type) -> TyFun [a1627856109] [Nat] -> *) (FindIndicesSym1 a1627856109) # 

Methods

suppressUnusedWarnings :: Proxy (FindIndicesSym1 a1627856109) t -> () #

SuppressUnusedWarnings ((TyFun a1627856110 Bool -> Type) -> TyFun [a1627856110] (Maybe Nat) -> *) (FindIndexSym1 a1627856110) # 

Methods

suppressUnusedWarnings :: Proxy (FindIndexSym1 a1627856110) t -> () #

SuppressUnusedWarnings ([a1627856083] -> TyFun Nat a1627856083 -> *) ((:!!$$) a1627856083) # 

Methods

suppressUnusedWarnings :: Proxy ((:!!$$) a1627856083) t -> () #

SuppressUnusedWarnings (Nat -> TyFun [a1627856100] [a1627856100] -> *) (DropSym1 a1627856100) # 

Methods

suppressUnusedWarnings :: Proxy (DropSym1 a1627856100) t -> () #

SuppressUnusedWarnings (Nat -> TyFun [a1627856101] [a1627856101] -> *) (TakeSym1 a1627856101) # 

Methods

suppressUnusedWarnings :: Proxy (TakeSym1 a1627856101) t -> () #

SuppressUnusedWarnings (Nat -> TyFun [a1627856099] ([a1627856099], [a1627856099]) -> *) (SplitAtSym1 a1627856099) # 

Methods

suppressUnusedWarnings :: Proxy (SplitAtSym1 a1627856099) t -> () #

SuppressUnusedWarnings (Nat -> TyFun a1627856085 [a1627856085] -> *) (ReplicateSym1 a1627856085) # 

Methods

suppressUnusedWarnings :: Proxy (ReplicateSym1 a1627856085) t -> () #

SuppressUnusedWarnings (Nat -> TyFun (NonEmpty a1628135958) [a1628135958] -> *) (TakeSym1 a1628135958) # 

Methods

suppressUnusedWarnings :: Proxy (TakeSym1 a1628135958) t -> () #

SuppressUnusedWarnings (Nat -> TyFun (NonEmpty a1628135957) [a1628135957] -> *) (DropSym1 a1628135957) # 

Methods

suppressUnusedWarnings :: Proxy (DropSym1 a1628135957) t -> () #

SuppressUnusedWarnings (Nat -> TyFun (NonEmpty a1628135956) ([a1628135956], [a1628135956]) -> *) (SplitAtSym1 a1628135956) # 

Methods

suppressUnusedWarnings :: Proxy (SplitAtSym1 a1628135956) t -> () #

SuppressUnusedWarnings (a1627856111 -> TyFun [a1627856111] [Nat] -> *) (ElemIndicesSym1 a1627856111) # 

Methods

suppressUnusedWarnings :: Proxy (ElemIndicesSym1 a1627856111) t -> () #

SuppressUnusedWarnings (a1627856112 -> TyFun [a1627856112] (Maybe Nat) -> *) (ElemIndexSym1 a1627856112) # 

Methods

suppressUnusedWarnings :: Proxy (ElemIndexSym1 a1627856112) t -> () #

SuppressUnusedWarnings (NonEmpty a1628135936 -> TyFun Nat a1628135936 -> *) ((:!!$$) a1628135936) # 

Methods

suppressUnusedWarnings :: Proxy ((:!!$$) a1628135936) t -> () #

SuppressUnusedWarnings (TyFun (TyFun a1627856109 Bool -> Type) (TyFun [a1627856109] [Nat] -> Type) -> *) (FindIndicesSym0 a1627856109) # 

Methods

suppressUnusedWarnings :: Proxy (FindIndicesSym0 a1627856109) t -> () #

SuppressUnusedWarnings (TyFun (TyFun a1627856110 Bool -> Type) (TyFun [a1627856110] (Maybe Nat) -> Type) -> *) (FindIndexSym0 a1627856110) # 

Methods

suppressUnusedWarnings :: Proxy (FindIndexSym0 a1627856110) t -> () #

SuppressUnusedWarnings (TyFun [a1627856083] (TyFun Nat a1627856083 -> Type) -> *) ((:!!$) a1627856083) # 

Methods

suppressUnusedWarnings :: Proxy ((:!!$) a1627856083) t -> () #

SuppressUnusedWarnings (TyFun [a1627856086] Nat -> *) (LengthSym0 a1627856086) # 

Methods

suppressUnusedWarnings :: Proxy (LengthSym0 a1627856086) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun [a1627856100] [a1627856100] -> Type) -> *) (DropSym0 a1627856100) # 

Methods

suppressUnusedWarnings :: Proxy (DropSym0 a1627856100) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun [a1627856101] [a1627856101] -> Type) -> *) (TakeSym0 a1627856101) # 

Methods

suppressUnusedWarnings :: Proxy (TakeSym0 a1627856101) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun [a1627856099] ([a1627856099], [a1627856099]) -> Type) -> *) (SplitAtSym0 a1627856099) # 

Methods

suppressUnusedWarnings :: Proxy (SplitAtSym0 a1627856099) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun a1627856085 [a1627856085] -> Type) -> *) (ReplicateSym0 a1627856085) # 

Methods

suppressUnusedWarnings :: Proxy (ReplicateSym0 a1627856085) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun (NonEmpty a1628135958) [a1628135958] -> Type) -> *) (TakeSym0 a1628135958) # 

Methods

suppressUnusedWarnings :: Proxy (TakeSym0 a1628135958) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun (NonEmpty a1628135957) [a1628135957] -> Type) -> *) (DropSym0 a1628135957) # 

Methods

suppressUnusedWarnings :: Proxy (DropSym0 a1628135957) t -> () #

SuppressUnusedWarnings (TyFun Nat (TyFun (NonEmpty a1628135956) ([a1628135956], [a1628135956]) -> Type) -> *) (SplitAtSym0 a1628135956) # 

Methods

suppressUnusedWarnings :: Proxy (SplitAtSym0 a1628135956) t -> () #

SuppressUnusedWarnings (TyFun Nat a1627807374 -> *) (FromIntegerSym0 a1627807374) # 

Methods

suppressUnusedWarnings :: Proxy (FromIntegerSym0 a1627807374) t -> () #

SuppressUnusedWarnings (TyFun Nat a1628217981 -> *) (ToEnumSym0 a1628217981) # 

Methods

suppressUnusedWarnings :: Proxy (ToEnumSym0 a1628217981) t -> () #

SuppressUnusedWarnings (TyFun a1627856111 (TyFun [a1627856111] [Nat] -> Type) -> *) (ElemIndicesSym0 a1627856111) # 

Methods

suppressUnusedWarnings :: Proxy (ElemIndicesSym0 a1627856111) t -> () #

SuppressUnusedWarnings (TyFun a1627856112 (TyFun [a1627856112] (Maybe Nat) -> Type) -> *) (ElemIndexSym0 a1627856112) # 

Methods

suppressUnusedWarnings :: Proxy (ElemIndexSym0 a1627856112) t -> () #

SuppressUnusedWarnings (TyFun a1628217981 Nat -> *) (FromEnumSym0 a1628217981) # 

Methods

suppressUnusedWarnings :: Proxy (FromEnumSym0 a1628217981) t -> () #

SuppressUnusedWarnings (TyFun (NonEmpty a1628135936) (TyFun Nat a1628135936 -> Type) -> *) ((:!!$) a1628135936) # 

Methods

suppressUnusedWarnings :: Proxy ((:!!$) a1628135936) t -> () #

SuppressUnusedWarnings (TyFun (NonEmpty a1628135989) Nat -> *) (LengthSym0 a1628135989) # 

Methods

suppressUnusedWarnings :: Proxy (LengthSym0 a1628135989) t -> () #

type Demote Nat # 
data Sing Nat # 
data Sing Nat where
type Negate Nat a # 
type Negate Nat a = Error Symbol Nat "Cannot negate a natural number"
type Abs Nat a # 
type Abs Nat a = a
type Signum Nat a # 
type Signum Nat a
type FromInteger Nat a # 
type FromInteger Nat a = a
type Succ Nat a # 
type Succ Nat a
type Pred Nat a # 
type Pred Nat a
type ToEnum Nat a # 
type ToEnum Nat a
type FromEnum Nat a # 
type FromEnum Nat a
type (==) Nat a b 
type (==) Nat a b = EqNat a b
type (:==) Nat a b # 
type (:==) Nat a b = (==) Nat a b
type (:/=) Nat x y # 
type (:/=) Nat x y = Not ((:==) Nat x y)
type Compare Nat a b # 
type Compare Nat a b = CmpNat a b
type (:<) Nat arg1 arg2 # 
type (:<) Nat arg1 arg2
type (:<=) Nat arg1 arg2 # 
type (:<=) Nat arg1 arg2
type (:>) Nat arg1 arg2 # 
type (:>) Nat arg1 arg2
type (:>=) Nat arg1 arg2 # 
type (:>=) Nat arg1 arg2
type Max Nat arg1 arg2 # 
type Max Nat arg1 arg2
type Min Nat arg1 arg2 # 
type Min Nat arg1 arg2
type (:+) Nat a b # 
type (:+) Nat a b = (+) a b
type (:-) Nat a b # 
type (:-) Nat a b = (-) a b
type (:*) Nat a b # 
type (:*) Nat a b = * a b
type EnumFromTo Nat a1 a2 # 
type EnumFromTo Nat a1 a2
type Apply Nat Constraint KnownNatSym0 l # 
type EnumFromThenTo Nat a1 a2 a3 # 
type EnumFromThenTo Nat a1 a2 a3
type Apply Nat Nat ((:^$$) l1) l2 # 
type Apply Nat Nat ((:^$$) l1) l2 = (:^) l1 l2
type Apply Nat k2 (FromIntegerSym0 k2) l # 
type Apply Nat k2 (FromIntegerSym0 k2) l = FromInteger k2 l
type Apply Nat k2 (ToEnumSym0 k2) l # 
type Apply Nat k2 (ToEnumSym0 k2) l = ToEnum k2 l
type Apply a Nat (FromEnumSym0 a) l # 
type Apply a Nat (FromEnumSym0 a) l = FromEnum a l
type Apply Nat a ((:!!$$) a l1) l2 # 
type Apply Nat a ((:!!$$) a l1) l2 = (:!!) a l1 l2
type Apply Nat a ((:!!$$) a l1) l2 # 
type Apply Nat a ((:!!$$) a l1) l2 = (:!!) a l1 l2
type Apply Nat (TyFun Nat Nat -> *) (:^$) l # 
type Apply Nat (TyFun Nat Nat -> *) (:^$) l = (:^$$) l
type Apply Nat (TyFun [a1627856100] [a1627856100] -> Type) (DropSym0 a1627856100) l # 
type Apply Nat (TyFun [a1627856100] [a1627856100] -> Type) (DropSym0 a1627856100) l = DropSym1 a1627856100 l
type Apply Nat (TyFun [a1627856101] [a1627856101] -> Type) (TakeSym0 a1627856101) l # 
type Apply Nat (TyFun [a1627856101] [a1627856101] -> Type) (TakeSym0 a1627856101) l = TakeSym1 a1627856101 l
type Apply Nat (TyFun [a1627856099] ([a1627856099], [a1627856099]) -> Type) (SplitAtSym0 a1627856099) l # 
type Apply Nat (TyFun [a1627856099] ([a1627856099], [a1627856099]) -> Type) (SplitAtSym0 a1627856099) l = SplitAtSym1 a1627856099 l
type Apply Nat (TyFun a1627856085 [a1627856085] -> Type) (ReplicateSym0 a1627856085) l # 
type Apply Nat (TyFun a1627856085 [a1627856085] -> Type) (ReplicateSym0 a1627856085) l = ReplicateSym1 a1627856085 l
type Apply Nat (TyFun (NonEmpty a1628135958) [a1628135958] -> Type) (TakeSym0 a1628135958) l # 
type Apply Nat (TyFun (NonEmpty a1628135958) [a1628135958] -> Type) (TakeSym0 a1628135958) l = TakeSym1 a1628135958 l
type Apply Nat (TyFun (NonEmpty a1628135957) [a1628135957] -> Type) (DropSym0 a1628135957) l # 
type Apply Nat (TyFun (NonEmpty a1628135957) [a1628135957] -> Type) (DropSym0 a1628135957) l = DropSym1 a1628135957 l
type Apply Nat (TyFun (NonEmpty a1628135956) ([a1628135956], [a1628135956]) -> Type) (SplitAtSym0 a1628135956) l # 
type Apply Nat (TyFun (NonEmpty a1628135956) ([a1628135956], [a1628135956]) -> Type) (SplitAtSym0 a1628135956) l = SplitAtSym1 a1628135956 l
type Apply a1627856111 (TyFun [a1627856111] [Nat] -> Type) (ElemIndicesSym0 a1627856111) l # 
type Apply a1627856111 (TyFun [a1627856111] [Nat] -> Type) (ElemIndicesSym0 a1627856111) l = ElemIndicesSym1 a1627856111 l
type Apply a1627856112 (TyFun [a1627856112] (Maybe Nat) -> Type) (ElemIndexSym0 a1627856112) l # 
type Apply a1627856112 (TyFun [a1627856112] (Maybe Nat) -> Type) (ElemIndexSym0 a1627856112) l = ElemIndexSym1 a1627856112 l
type Apply [a] Nat (LengthSym0 a) l # 
type Apply [a] Nat (LengthSym0 a) l = Length a l
type Apply (NonEmpty a) Nat (LengthSym0 a) l # 
type Apply (NonEmpty a) Nat (LengthSym0 a) l = Length a l
type Apply [a] [Nat] (FindIndicesSym1 a l1) l2 # 
type Apply [a] [Nat] (FindIndicesSym1 a l1) l2 = FindIndices a l1 l2
type Apply [a] [Nat] (ElemIndicesSym1 a l1) l2 # 
type Apply [a] [Nat] (ElemIndicesSym1 a l1) l2 = ElemIndices a l1 l2
type Apply [a] (Maybe Nat) (FindIndexSym1 a l1) l2 # 
type Apply [a] (Maybe Nat) (FindIndexSym1 a l1) l2 = FindIndex a l1 l2
type Apply [a] (Maybe Nat) (ElemIndexSym1 a l1) l2 # 
type Apply [a] (Maybe Nat) (ElemIndexSym1 a l1) l2 = ElemIndex a l1 l2
type Apply [a1627856083] (TyFun Nat a1627856083 -> Type) ((:!!$) a1627856083) l # 
type Apply [a1627856083] (TyFun Nat a1627856083 -> Type) ((:!!$) a1627856083) l = (:!!$$) a1627856083 l
type Apply (NonEmpty a1628135936) (TyFun Nat a1628135936 -> Type) ((:!!$) a1628135936) l # 
type Apply (NonEmpty a1628135936) (TyFun Nat a1628135936 -> Type) ((:!!$) a1628135936) l = (:!!$$) a1628135936 l
type Apply (TyFun a1627856109 Bool -> Type) (TyFun [a1627856109] [Nat] -> Type) (FindIndicesSym0 a1627856109) l # 
type Apply (TyFun a1627856109 Bool -> Type) (TyFun [a1627856109] [Nat] -> Type) (FindIndicesSym0 a1627856109) l = FindIndicesSym1 a1627856109 l
type Apply (TyFun a1627856110 Bool -> Type) (TyFun [a1627856110] (Maybe Nat) -> Type) (FindIndexSym0 a1627856110) l # 
type Apply (TyFun a1627856110 Bool -> Type) (TyFun [a1627856110] (Maybe Nat) -> Type) (FindIndexSym0 a1627856110) l = FindIndexSym1 a1627856110 l

data Symbol :: * #

(Kind) This is the kind of type-level symbols. Declared here because class IP needs it

Instances

SingKind Symbol

Since: 4.9.0.0

Associated Types

type DemoteRep Symbol :: *

Methods

fromSing :: Sing Symbol a -> DemoteRep Symbol

KnownSymbol a => SingI Symbol a

Since: 4.9.0.0

Methods

sing :: Sing a a

SuppressUnusedWarnings (TyFun Symbol Constraint -> *) KnownSymbolSym0 # 
data Sing Symbol 
data Sing Symbol where
type DemoteRep Symbol 
type DemoteRep Symbol = String
type Demote Symbol # 
data Sing Symbol # 
data Sing Symbol where
type (==) Symbol a b 
type (==) Symbol a b = EqSymbol a b
type (:==) Symbol a b # 
type (:==) Symbol a b = (==) Symbol a b
type (:/=) Symbol x y # 
type (:/=) Symbol x y = Not ((:==) Symbol x y)
type Compare Symbol a b # 
type Compare Symbol a b = CmpSymbol a b
type (:<) Symbol arg1 arg2 # 
type (:<) Symbol arg1 arg2
type (:<=) Symbol arg1 arg2 # 
type (:<=) Symbol arg1 arg2
type (:>) Symbol arg1 arg2 # 
type (:>) Symbol arg1 arg2
type (:>=) Symbol arg1 arg2 # 
type (:>=) Symbol arg1 arg2
type Max Symbol arg1 arg2 # 
type Max Symbol arg1 arg2
type Min Symbol arg1 arg2 # 
type Min Symbol arg1 arg2
type Apply Symbol Constraint KnownSymbolSym0 l # 

data family Sing (a :: k) #

The singleton kind-indexed data family.

Instances

data Sing Bool # 
data Sing Bool where
data Sing Ordering # 
data Sing * # 
data Sing * where
data Sing Nat # 
data Sing Nat where
data Sing Symbol # 
data Sing Symbol where
data Sing () # 
data Sing () where
data Sing [a] # 
data Sing [a] where
data Sing (Maybe a) # 
data Sing (Maybe a) where
data Sing (NonEmpty a) # 
data Sing (NonEmpty a) where
data Sing (Either a b) # 
data Sing (Either a b) where
data Sing (a, b) # 
data Sing (a, b) where
data Sing ((~>) k1 k2) # 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a, b, c) # 
data Sing (a, b, c) where
data Sing (a, b, c, d) # 
data Sing (a, b, c, d) where
data Sing (a, b, c, d, e) # 
data Sing (a, b, c, d, e) where
data Sing (a, b, c, d, e, f) # 
data Sing (a, b, c, d, e, f) where
data Sing (a, b, c, d, e, f, g) # 
data Sing (a, b, c, d, e, f, g) where

type SNat (x :: Nat) = Sing x #

Kind-restricted synonym for Sing for Nats

type SSymbol (x :: Symbol) = Sing x #

Kind-restricted synonym for Sing for Symbols

withKnownNat :: Sing n -> (KnownNat n => r) -> r #

Given a singleton for Nat, call something requiring a KnownNat instance.

withKnownSymbol :: Sing n -> (KnownSymbol n => r) -> r #

Given a singleton for Symbol, call something requiring a KnownSymbol instance.

type family Error (str :: k0) :: k #

The promotion of error. This version is more poly-kinded for easier use.

data ErrorSym0 (l :: TyFun k01627798799 k1627798801) #

Instances

SuppressUnusedWarnings (TyFun k01627798799 k1627798801 -> *) (ErrorSym0 k01627798799 k1627798801) # 

Methods

suppressUnusedWarnings :: Proxy (ErrorSym0 k01627798799 k1627798801) t -> () #

type Apply k0 k2 (ErrorSym0 k0 k2) l # 
type Apply k0 k2 (ErrorSym0 k0 k2) l = Error k0 k2 l

type ErrorSym1 (t :: k01627798799) = Error t #

sError :: Sing (str :: Symbol) -> a #

The singleton for error

class KnownNat (n :: Nat) #

This class gives the integer associated with a type-level natural. There are instances of the class for every concrete literal: 0, 1, 2, etc.

Since: 4.7.0.0

Minimal complete definition

natSing

type KnownNatSym1 (t :: Nat) = KnownNat t #

natVal :: KnownNat n => proxy n -> Integer #

Since: 4.7.0.0

class KnownSymbol (n :: Symbol) #

This class gives the string associated with a type-level symbol. There are instances of the class for every concrete literal: "hello", etc.

Since: 4.7.0.0

Minimal complete definition

symbolSing

symbolVal :: KnownSymbol n => proxy n -> String #

Since: 4.7.0.0

type (:^) a b = a ^ b infixr 8 #

data (:^$) l #

Instances

data (l :: Nat) :^$$ l #

Instances

SuppressUnusedWarnings (Nat -> TyFun Nat Nat -> *) (:^$$) # 
type Apply Nat Nat ((:^$$) l1) l2 # 
type Apply Nat Nat ((:^$$) l1) l2 = (:^) l1 l2

type (:^$$$) (t :: Nat) (t :: Nat) = (:^) t t #

Orphan instances

Eq Nat # 

Methods

(==) :: Nat -> Nat -> Bool #

(/=) :: Nat -> Nat -> Bool #

Eq Symbol #

This bogus instance is helpful for people who want to define functions over Symbols that will only be used at the type level or as singletons.

Methods

(==) :: Symbol -> Symbol -> Bool #

(/=) :: Symbol -> Symbol -> Bool #

Num Nat #

This bogus Num instance is helpful for people who want to define functions over Nats that will only be used at the type level or as singletons. A correct SNum instance for Nat singletons exists.

Methods

(+) :: Nat -> Nat -> Nat #

(-) :: Nat -> Nat -> Nat #

(*) :: Nat -> Nat -> Nat #

negate :: Nat -> Nat #

abs :: Nat -> Nat #

signum :: Nat -> Nat #

fromInteger :: Integer -> Nat #

Ord Nat # 

Methods

compare :: Nat -> Nat -> Ordering #

(<) :: Nat -> Nat -> Bool #

(<=) :: Nat -> Nat -> Bool #

(>) :: Nat -> Nat -> Bool #

(>=) :: Nat -> Nat -> Bool #

max :: Nat -> Nat -> Nat #

min :: Nat -> Nat -> Nat #

Ord Symbol #