singletons-0.9.3: A framework for generating singleton types

Copyright(C) 2013 Richard Eisenberg
License(C) 2013 Richard Eisenberg
MaintainerRichard Eisenberg (eir@cis.upenn.edu)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone

Data.Singletons.Maybe

Contents

Description

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

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

Synopsis

Documentation

data family Sing a Source

The singleton kind-indexed data family.

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

 SNothing :: Sing Nothing
 SJust    :: Sing a -> Sing (Just a)

type SMaybe z = Sing zSource

SBool is a kind-restricted synonym for Sing: type SMaybe (a :: Maybe k) = Sing a

Singletons from Data.Maybe

type family Maybe_ a a a :: bSource

sMaybe_ :: forall t t t. Sing t -> (forall t. Sing t -> Sing (t t)) -> Sing t -> Sing (Maybe_ t t t)Source

The preceding two definitions are derived from the function maybe in Data.Maybe. The extra underscore is to avoid name clashes with the type Maybe.

type family IsJust a :: BoolSource

sIsJust :: forall t. Sing t -> Sing (IsJust t)Source

type family IsNothing a :: BoolSource

sIsNothing :: forall t. Sing t -> Sing (IsNothing t)Source

type family FromJust a :: aSource

sFromJust :: forall t. Sing t -> Sing (FromJust t)Source

type family FromMaybe a a :: aSource

sFromMaybe :: forall t t. Sing t -> Sing t -> Sing (FromMaybe t t)Source

type family MaybeToList a :: [a]Source

sMaybeToList :: forall t. Sing t -> Sing (MaybeToList t)Source

type family ListToMaybe a :: Maybe aSource

sListToMaybe :: forall t. Sing t -> Sing (ListToMaybe t)Source

type family CatMaybes a :: [a]Source

sCatMaybes :: forall t. Sing t -> Sing (CatMaybes t)Source

type family MapMaybe a a :: [b]Source

sMapMaybe :: forall t t. (forall t. Sing t -> Sing (t t)) -> Sing t -> Sing (MapMaybe t t)Source