singletons-0.10.0: A framework for generating singleton types

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

Data.Singletons.List

Contents

Description

Defines functions and datatypes relating to the singleton for '[]', including a singletons version of a few of the definitions in Data.List.

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.List. Also, please excuse the apparent repeated variable names. This is due to an interaction between Template Haskell and Haddock.

Synopsis

The singleton for lists

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 (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

SNil  :: Sing '[]
SCons :: Sing (h :: k) -> Sing (t :: [k]) -> Sing (h ': t)

type SList z = Sing z Source

SList is a kind-restricted synonym for Sing: type SList (a :: [k]) = Sing a

type family Head a :: a Source

Equations

Head ((:) a z) = a 
Head [] = Error "Data.Singletons.List.head: empty list" 

type family Tail a :: [a] Source

Equations

Tail ((:) z t) = t 
Tail [] = Error "Data.Singletons.List.tail: empty list" 

sHead :: forall t. Sing t -> Sing (Head t) Source

sTail :: forall t. Sing t -> Sing (Tail t) Source

type family a :++ a :: [a] Source

Equations

[] :++ a = a 
((:) h t) :++ a = (:) h ((:++) t a) 

(%:++) :: forall t t. Sing t -> Sing t -> Sing ((:++) t t) Source

type family Reverse a :: [a] Source

Equations

Reverse list = Reverse_aux `[]` list 

sReverse :: forall t. Sing t -> Sing (Reverse t) Source