singletons-2.3.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.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 [a] Source # 
data Sing [a] where
data Sing (Maybe a) Source # 
data Sing (Maybe a) where
data Sing (NonEmpty a) Source # 
data Sing (NonEmpty a) where
data Sing (Either a b) Source # 
data Sing (Either a b) where
data Sing (a, b) Source # 
data Sing (a, b) where
data Sing ((~>) k1 k2) Source # 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a, b, c) Source # 
data Sing (a, b, c) where
data Sing (a, b, c, d) Source # 
data Sing (a, b, c, d) where
data Sing (a, b, c, d, e) Source # 
data Sing (a, b, c, d, e) where
data Sing (a, b, c, d, e, f) Source # 
data Sing (a, b, c, d, e, f) where
data Sing (a, b, c, d, e, f, g) Source # 
data Sing (a, b, c, d, e, f, g) 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_ :: 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_6989586621679426466 Nothing = n 
Maybe_ _z_6989586621679426469 f (Just x) = Apply f x 

sMaybe_ :: forall (t :: b) (t :: TyFun a b -> Type) (t :: Maybe a). 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_6989586621679427678) = TrueSym0 

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

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

Equations

IsNothing Nothing = TrueSym0 
IsNothing (Just _z_6989586621679427671) = FalseSym0 

sIsNothing :: forall (t :: Maybe a). 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 :: Maybe a). Sing t -> Sing (Apply FromJustSym0 t :: a) Source #

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

Equations

FromMaybe d x = Case_6989586621679427658 d x x 

sFromMaybe :: forall (t :: a) (t :: Maybe a). 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_6989586621679427639) = Apply JustSym0 a 

sListToMaybe :: forall (t :: [a]). Sing t -> Sing (Apply ListToMaybeSym0 t :: Maybe a) Source #

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

Equations

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

sMaybeToList :: forall (t :: Maybe a). 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 :: [Maybe a]). 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_6989586621679427591 '[] = '[] 
MapMaybe f ((:) x xs) = Case_6989586621679427623 f x xs (Let6989586621679427610Scrutinee_6989586621679427580Sym3 f x xs) 

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

Defunctionalization symbols

data JustSym0 (l :: TyFun a3530822107858468865 (Maybe a3530822107858468865)) Source #

Instances

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

Methods

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

type Apply a (Maybe a) (JustSym0 a) l Source # 
type Apply a (Maybe a) (JustSym0 a) l = Just a l

type JustSym1 (t :: a3530822107858468865) = Just t Source #

data Maybe_Sym0 (l :: TyFun b6989586621679426444 (TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) -> Type)) Source #

Instances

SuppressUnusedWarnings (TyFun b6989586621679426444 (TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) -> Type) -> *) (Maybe_Sym0 a6989586621679426445 b6989586621679426444) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym0 a6989586621679426445 b6989586621679426444) t -> () Source #

type Apply b6989586621679426444 (TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) -> Type) (Maybe_Sym0 a6989586621679426445 b6989586621679426444) l Source # 
type Apply b6989586621679426444 (TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) -> Type) (Maybe_Sym0 a6989586621679426445 b6989586621679426444) l = Maybe_Sym1 a6989586621679426445 b6989586621679426444 l

data Maybe_Sym1 (l :: b6989586621679426444) (l :: TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type)) Source #

Instances

SuppressUnusedWarnings (b6989586621679426444 -> TyFun (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) -> *) (Maybe_Sym1 a6989586621679426445 b6989586621679426444) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym1 a6989586621679426445 b6989586621679426444) t -> () Source #

type Apply (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) (Maybe_Sym1 a6989586621679426445 b6989586621679426444 l1) l2 Source # 
type Apply (TyFun a6989586621679426445 b6989586621679426444 -> Type) (TyFun (Maybe a6989586621679426445) b6989586621679426444 -> Type) (Maybe_Sym1 a6989586621679426445 b6989586621679426444 l1) l2 = Maybe_Sym2 a6989586621679426445 b6989586621679426444 l1 l2

data Maybe_Sym2 (l :: b6989586621679426444) (l :: TyFun a6989586621679426445 b6989586621679426444 -> Type) (l :: TyFun (Maybe a6989586621679426445) b6989586621679426444) Source #

Instances

SuppressUnusedWarnings (b6989586621679426444 -> (TyFun a6989586621679426445 b6989586621679426444 -> Type) -> TyFun (Maybe a6989586621679426445) b6989586621679426444 -> *) (Maybe_Sym2 a6989586621679426445 b6989586621679426444) Source # 

Methods

suppressUnusedWarnings :: Proxy (Maybe_Sym2 a6989586621679426445 b6989586621679426444) t -> () Source #

type Apply (Maybe a) b (Maybe_Sym2 a b l1 l2) l3 Source # 
type Apply (Maybe a) b (Maybe_Sym2 a b l1 l2) l3 = Maybe_ a b l1 l2 l3

type Maybe_Sym3 (t :: b6989586621679426444) (t :: TyFun a6989586621679426445 b6989586621679426444 -> Type) (t :: Maybe a6989586621679426445) = Maybe_ t t t Source #

data IsJustSym0 (l :: TyFun (Maybe a6989586621679427557) Bool) Source #

Instances

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

Methods

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

type Apply (Maybe a) Bool (IsJustSym0 a) l Source # 
type Apply (Maybe a) Bool (IsJustSym0 a) l = IsJust a l

type IsJustSym1 (t :: Maybe a6989586621679427557) = IsJust t Source #

data IsNothingSym0 (l :: TyFun (Maybe a6989586621679427556) Bool) Source #

Instances

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

Methods

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

type Apply (Maybe a) Bool (IsNothingSym0 a) l Source # 
type Apply (Maybe a) Bool (IsNothingSym0 a) l = IsNothing a l

type IsNothingSym1 (t :: Maybe a6989586621679427556) = IsNothing t Source #

data FromJustSym0 (l :: TyFun (Maybe a6989586621679427555) a6989586621679427555) Source #

Instances

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

Methods

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

type Apply (Maybe a) a (FromJustSym0 a) l Source # 
type Apply (Maybe a) a (FromJustSym0 a) l = FromJust a l

type FromJustSym1 (t :: Maybe a6989586621679427555) = FromJust t Source #

data FromMaybeSym0 (l :: TyFun a6989586621679427554 (TyFun (Maybe a6989586621679427554) a6989586621679427554 -> Type)) Source #

Instances

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

Methods

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

type Apply a6989586621679427554 (TyFun (Maybe a6989586621679427554) a6989586621679427554 -> Type) (FromMaybeSym0 a6989586621679427554) l Source # 
type Apply a6989586621679427554 (TyFun (Maybe a6989586621679427554) a6989586621679427554 -> Type) (FromMaybeSym0 a6989586621679427554) l = FromMaybeSym1 a6989586621679427554 l

data FromMaybeSym1 (l :: a6989586621679427554) (l :: TyFun (Maybe a6989586621679427554) a6989586621679427554) Source #

Instances

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

Methods

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

type Apply (Maybe a) a (FromMaybeSym1 a l1) l2 Source # 
type Apply (Maybe a) a (FromMaybeSym1 a l1) l2 = FromMaybe a l1 l2

type FromMaybeSym2 (t :: a6989586621679427554) (t :: Maybe a6989586621679427554) = FromMaybe t t Source #

data ListToMaybeSym0 (l :: TyFun [a6989586621679427552] (Maybe a6989586621679427552)) Source #

Instances

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

Methods

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

type Apply [a] (Maybe a) (ListToMaybeSym0 a) l Source # 
type Apply [a] (Maybe a) (ListToMaybeSym0 a) l = ListToMaybe a l

type ListToMaybeSym1 (t :: [a6989586621679427552]) = ListToMaybe t Source #

data MaybeToListSym0 (l :: TyFun (Maybe a6989586621679427553) [a6989586621679427553]) Source #

Instances

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

Methods

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

type Apply (Maybe a) [a] (MaybeToListSym0 a) l Source # 
type Apply (Maybe a) [a] (MaybeToListSym0 a) l = MaybeToList a l

type MaybeToListSym1 (t :: Maybe a6989586621679427553) = MaybeToList t Source #

data CatMaybesSym0 (l :: TyFun [Maybe a6989586621679427551] [a6989586621679427551]) Source #

Instances

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

Methods

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

type Apply [Maybe a] [a] (CatMaybesSym0 a) l Source # 
type Apply [Maybe a] [a] (CatMaybesSym0 a) l = CatMaybes a l

type CatMaybesSym1 (t :: [Maybe a6989586621679427551]) = CatMaybes t Source #

data MapMaybeSym0 (l :: TyFun (TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (TyFun [a6989586621679427549] [b6989586621679427550] -> Type)) Source #

Instances

SuppressUnusedWarnings (TyFun (TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (TyFun [a6989586621679427549] [b6989586621679427550] -> Type) -> *) (MapMaybeSym0 a6989586621679427549 b6989586621679427550) Source # 

Methods

suppressUnusedWarnings :: Proxy (MapMaybeSym0 a6989586621679427549 b6989586621679427550) t -> () Source #

type Apply (TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (TyFun [a6989586621679427549] [b6989586621679427550] -> Type) (MapMaybeSym0 a6989586621679427549 b6989586621679427550) l Source # 
type Apply (TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (TyFun [a6989586621679427549] [b6989586621679427550] -> Type) (MapMaybeSym0 a6989586621679427549 b6989586621679427550) l = MapMaybeSym1 a6989586621679427549 b6989586621679427550 l

data MapMaybeSym1 (l :: TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (l :: TyFun [a6989586621679427549] [b6989586621679427550]) Source #

Instances

SuppressUnusedWarnings ((TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) -> TyFun [a6989586621679427549] [b6989586621679427550] -> *) (MapMaybeSym1 a6989586621679427549 b6989586621679427550) Source # 

Methods

suppressUnusedWarnings :: Proxy (MapMaybeSym1 a6989586621679427549 b6989586621679427550) t -> () Source #

type Apply [a] [b] (MapMaybeSym1 a b l1) l2 Source # 
type Apply [a] [b] (MapMaybeSym1 a b l1) l2 = MapMaybe a b l1 l2

type MapMaybeSym2 (t :: TyFun a6989586621679427549 (Maybe b6989586621679427550) -> Type) (t :: [a6989586621679427549]) = MapMaybe t t Source #