singletons-2.2: 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.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 :: k) Source #

The singleton kind-indexed data family.

Instances

data Sing Bool Source # 
data Sing Bool where
data Sing Ordering Source # 
data Sing * Source # 
data Sing * where
data Sing Nat Source # 
data Sing Nat where
data Sing Symbol Source # 
data Sing Symbol where
data Sing () Source # 
data Sing () where
data Sing [a0] Source # 
data Sing [a0] where
data Sing (Maybe a0) Source # 
data Sing (Maybe a0) where
data Sing (NonEmpty a0) Source # 
data Sing (NonEmpty a0) where
data Sing (Either a0 b0) Source # 
data Sing (Either a0 b0) where
data Sing (a0, b0) Source # 
data Sing (a0, b0) where
data Sing ((~>) k1 k2) Source # 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a0, b0, c0) Source # 
data Sing (a0, b0, c0) where
data Sing (a0, b0, c0, d0) Source # 
data Sing (a0, b0, c0, d0) where
data Sing (a0, b0, c0, d0, e0) Source # 
data Sing (a0, b0, c0, d0, e0) where
data Sing (a0, b0, c0, d0, e0, f0) Source # 
data Sing (a0, b0, c0, d0, e0, f0) where
data Sing (a0, b0, c0, d0, e0, f0, g0) Source # 
data Sing (a0, b0, c0, d0, e0, f0, g0) where

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

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

type SMaybe = (Sing :: Maybe a -> Type) Source #

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

Singletons from Data.Maybe

maybe_ :: forall b a. b -> (a -> b) -> Maybe a -> b Source #

type family Maybe_ (a :: b) (a :: TyFun a b -> Type) (a :: Maybe a) :: b where ... Source #

Equations

Maybe_ n _z_1627847793 Nothing = n 
Maybe_ _z_1627847796 f (Just x) = Apply f x 

sMaybe_ :: forall t t t. Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Maybe_Sym0 t) t) t :: b) 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 :: Maybe a) :: Bool where ... Source #

Equations

IsJust Nothing = FalseSym0 
IsJust (Just _z_1627849157) = TrueSym0 

sIsJust :: forall t. Sing t -> Sing (Apply IsJustSym0 t :: Bool) Source #

type family IsNothing (a :: Maybe a) :: Bool where ... Source #

Equations

IsNothing Nothing = TrueSym0 
IsNothing (Just _z_1627849150) = FalseSym0 

sIsNothing :: forall t. Sing t -> Sing (Apply IsNothingSym0 t :: Bool) Source #

type family FromJust (a :: Maybe a) :: a where ... Source #

Equations

FromJust Nothing = Apply ErrorSym0 "Maybe.fromJust: Nothing" 
FromJust (Just x) = x 

sFromJust :: forall t. Sing t -> Sing (Apply FromJustSym0 t :: a) Source #

type family FromMaybe (a :: a) (a :: Maybe a) :: a where ... Source #

Equations

FromMaybe d x = Case_1627849137 d x x 

sFromMaybe :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply FromMaybeSym0 t) t :: a) Source #

type family ListToMaybe (a :: [a]) :: Maybe a where ... Source #

Equations

ListToMaybe '[] = NothingSym0 
ListToMaybe ((:) a _z_1627849118) = Apply JustSym0 a 

type family MaybeToList (a :: Maybe a) :: [a] where ... Source #

Equations

MaybeToList Nothing = '[] 
MaybeToList (Just x) = Apply (Apply (:$) x) '[] 

sMaybeToList :: forall t. Sing t -> Sing (Apply MaybeToListSym0 t :: [a]) Source #

type family CatMaybes (a :: [Maybe a]) :: [a] where ... Source #

Equations

CatMaybes '[] = '[] 
CatMaybes ((:) (Just x) xs) = Apply (Apply (:$) x) (Apply CatMaybesSym0 xs) 
CatMaybes ((:) Nothing xs) = Apply CatMaybesSym0 xs 

sCatMaybes :: forall t. Sing t -> Sing (Apply CatMaybesSym0 t :: [a]) Source #

type family MapMaybe (a :: TyFun a (Maybe b) -> Type) (a :: [a]) :: [b] where ... Source #

Equations

MapMaybe _z_1627849070 '[] = '[] 
MapMaybe f ((:) x xs) = Case_1627849102 f x xs (Let1627849089Scrutinee_1627849059Sym3 f x xs) 

sMapMaybe :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply MapMaybeSym0 t) t :: [b]) Source #

Defunctionalization symbols

data JustSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun a822083586 (Maybe a822083586) -> *) (JustSym0 a822083586) Source # 

Methods

suppressUnusedWarnings :: Proxy (JustSym0 a822083586) t -> () Source #

type Apply a822083586 (Maybe a822083586) (JustSym0 a822083586) l0 Source # 
type Apply a822083586 (Maybe a822083586) (JustSym0 a822083586) l0 = JustSym1 a822083586 l0

type JustSym1 t = Just t Source #

data Maybe_Sym0 l Source #

Instances

SuppressUnusedWarnings (TyFun b1627847771 (TyFun (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) -> Type) -> *) (Maybe_Sym0 a1627847772 b1627847771) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym0 a1627847772 b1627847771) t -> () Source #

type Apply b1627847771 (TyFun (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) -> Type) (Maybe_Sym0 a1627847772 b1627847771) l0 Source # 
type Apply b1627847771 (TyFun (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) -> Type) (Maybe_Sym0 a1627847772 b1627847771) l0 = Maybe_Sym1 a1627847772 b1627847771 l0

data Maybe_Sym1 l l Source #

Instances

SuppressUnusedWarnings (b1627847771 -> TyFun (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) -> *) (Maybe_Sym1 a1627847772 b1627847771) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym1 a1627847772 b1627847771) t -> () Source #

type Apply (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) (Maybe_Sym1 a1627847772 b1627847771 l1) l0 Source # 
type Apply (TyFun a1627847772 b1627847771 -> Type) (TyFun (Maybe a1627847772) b1627847771 -> Type) (Maybe_Sym1 a1627847772 b1627847771 l1) l0 = Maybe_Sym2 a1627847772 b1627847771 l1 l0

data Maybe_Sym2 l l l Source #

Instances

SuppressUnusedWarnings (b1627847771 -> (TyFun a1627847772 b1627847771 -> Type) -> TyFun (Maybe a1627847772) b1627847771 -> *) (Maybe_Sym2 a1627847772 b1627847771) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym2 a1627847772 b1627847771) t -> () Source #

type Apply (Maybe a1627847772) b1627847771 (Maybe_Sym2 a1627847772 b1627847771 l1 l2) l0 Source # 
type Apply (Maybe a1627847772) b1627847771 (Maybe_Sym2 a1627847772 b1627847771 l1 l2) l0 = Maybe_Sym3 b1627847771 a1627847772 l1 l2 l0

type Maybe_Sym3 t t t = Maybe_ t t t Source #

data IsJustSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun (Maybe a1627849036) Bool -> *) (IsJustSym0 a1627849036) Source # 

Methods

suppressUnusedWarnings :: Proxy (IsJustSym0 a1627849036) t -> () Source #

type Apply (Maybe a1627849036) Bool (IsJustSym0 a1627849036) l0 Source # 
type Apply (Maybe a1627849036) Bool (IsJustSym0 a1627849036) l0 = IsJustSym1 a1627849036 l0

data IsNothingSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun (Maybe a1627849035) Bool -> *) (IsNothingSym0 a1627849035) Source # 

Methods

suppressUnusedWarnings :: Proxy (IsNothingSym0 a1627849035) t -> () Source #

type Apply (Maybe a1627849035) Bool (IsNothingSym0 a1627849035) l0 Source # 
type Apply (Maybe a1627849035) Bool (IsNothingSym0 a1627849035) l0 = IsNothingSym1 a1627849035 l0

data FromJustSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun (Maybe a1627849034) a1627849034 -> *) (FromJustSym0 a1627849034) Source # 

Methods

suppressUnusedWarnings :: Proxy (FromJustSym0 a1627849034) t -> () Source #

type Apply (Maybe a1627849034) a1627849034 (FromJustSym0 a1627849034) l0 Source # 
type Apply (Maybe a1627849034) a1627849034 (FromJustSym0 a1627849034) l0 = FromJustSym1 a1627849034 l0

data FromMaybeSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun a1627849033 (TyFun (Maybe a1627849033) a1627849033 -> Type) -> *) (FromMaybeSym0 a1627849033) Source # 

Methods

suppressUnusedWarnings :: Proxy (FromMaybeSym0 a1627849033) t -> () Source #

type Apply a1627849033 (TyFun (Maybe a1627849033) a1627849033 -> Type) (FromMaybeSym0 a1627849033) l0 Source # 
type Apply a1627849033 (TyFun (Maybe a1627849033) a1627849033 -> Type) (FromMaybeSym0 a1627849033) l0 = FromMaybeSym1 a1627849033 l0

data FromMaybeSym1 l l Source #

Instances

SuppressUnusedWarnings (a1627849033 -> TyFun (Maybe a1627849033) a1627849033 -> *) (FromMaybeSym1 a1627849033) Source # 

Methods

suppressUnusedWarnings :: Proxy (FromMaybeSym1 a1627849033) t -> () Source #

type Apply (Maybe a1627849033) a1627849033 (FromMaybeSym1 a1627849033 l1) l0 Source # 
type Apply (Maybe a1627849033) a1627849033 (FromMaybeSym1 a1627849033 l1) l0 = FromMaybeSym2 a1627849033 l1 l0

data ListToMaybeSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun [a1627849031] (Maybe a1627849031) -> *) (ListToMaybeSym0 a1627849031) Source # 

Methods

suppressUnusedWarnings :: Proxy (ListToMaybeSym0 a1627849031) t -> () Source #

type Apply [a1627849031] (Maybe a1627849031) (ListToMaybeSym0 a1627849031) l0 Source # 
type Apply [a1627849031] (Maybe a1627849031) (ListToMaybeSym0 a1627849031) l0 = ListToMaybeSym1 a1627849031 l0

data MaybeToListSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun (Maybe a1627849032) [a1627849032] -> *) (MaybeToListSym0 a1627849032) Source # 

Methods

suppressUnusedWarnings :: Proxy (MaybeToListSym0 a1627849032) t -> () Source #

type Apply (Maybe a1627849032) [a1627849032] (MaybeToListSym0 a1627849032) l0 Source # 
type Apply (Maybe a1627849032) [a1627849032] (MaybeToListSym0 a1627849032) l0 = MaybeToListSym1 a1627849032 l0

data CatMaybesSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun [Maybe a1627849030] [a1627849030] -> *) (CatMaybesSym0 a1627849030) Source # 

Methods

suppressUnusedWarnings :: Proxy (CatMaybesSym0 a1627849030) t -> () Source #

type Apply [Maybe a1627849030] [a1627849030] (CatMaybesSym0 a1627849030) l0 Source # 
type Apply [Maybe a1627849030] [a1627849030] (CatMaybesSym0 a1627849030) l0 = CatMaybesSym1 a1627849030 l0

data MapMaybeSym0 l Source #

Instances

SuppressUnusedWarnings (TyFun (TyFun a1627849028 (Maybe b1627849029) -> Type) (TyFun [a1627849028] [b1627849029] -> Type) -> *) (MapMaybeSym0 a1627849028 b1627849029) Source # 

Methods

suppressUnusedWarnings :: Proxy (MapMaybeSym0 a1627849028 b1627849029) t -> () Source #

type Apply (TyFun a1627849028 (Maybe b1627849029) -> Type) (TyFun [a1627849028] [b1627849029] -> Type) (MapMaybeSym0 a1627849028 b1627849029) l0 Source # 
type Apply (TyFun a1627849028 (Maybe b1627849029) -> Type) (TyFun [a1627849028] [b1627849029] -> Type) (MapMaybeSym0 a1627849028 b1627849029) l0 = MapMaybeSym1 a1627849028 b1627849029 l0

data MapMaybeSym1 l l Source #

Instances

SuppressUnusedWarnings ((TyFun a1627849028 (Maybe b1627849029) -> Type) -> TyFun [a1627849028] [b1627849029] -> *) (MapMaybeSym1 a1627849028 b1627849029) Source # 

Methods

suppressUnusedWarnings :: Proxy (MapMaybeSym1 a1627849028 b1627849029) t -> () Source #

type Apply [a1627849028] [b1627849029] (MapMaybeSym1 a1627849028 b1627849029 l1) l0 Source # 
type Apply [a1627849028] [b1627849029] (MapMaybeSym1 a1627849028 b1627849029 l1) l0 = MapMaybeSym2 a1627849028 b1627849029 l1 l0

type MapMaybeSym2 t t = MapMaybe t t Source #