Copyright | (C) 2013-2014 Richard Eisenberg, Jan Stolarek |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Richard Eisenberg (eir@cis.upenn.edu) |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
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.
- data family Sing a
- type SMaybe = (Sing :: Maybe a -> *)
- maybe_ :: forall b a. b -> (a -> b) -> Maybe a -> b
- type family Maybe_ a a a :: b
- sMaybe_ :: forall t t t. Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Maybe_Sym0 t) t) t :: b)
- type family IsJust a :: Bool
- sIsJust :: forall t. Sing t -> Sing (Apply IsJustSym0 t :: Bool)
- type family IsNothing a :: Bool
- sIsNothing :: forall t. Sing t -> Sing (Apply IsNothingSym0 t :: Bool)
- type family FromJust a :: a
- sFromJust :: forall t. Sing t -> Sing (Apply FromJustSym0 t :: a)
- type family FromMaybe a a :: a
- sFromMaybe :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply FromMaybeSym0 t) t :: a)
- type family ListToMaybe a :: Maybe a
- sListToMaybe :: forall t. Sing t -> Sing (Apply ListToMaybeSym0 t :: Maybe a)
- type family MaybeToList a :: [a]
- sMaybeToList :: forall t. Sing t -> Sing (Apply MaybeToListSym0 t :: [a])
- type family CatMaybes a :: [a]
- sCatMaybes :: forall t. Sing t -> Sing (Apply CatMaybesSym0 t :: [a])
- type family MapMaybe a a :: [b]
- sMapMaybe :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply MapMaybeSym0 t) t :: [b])
- type NothingSym0 = Nothing
- data JustSym0 l
- type JustSym1 t = Just t
- data Maybe_Sym0 l
- data Maybe_Sym1 l l
- data Maybe_Sym2 l l l
- type Maybe_Sym3 t t t = Maybe_ t t t
- data IsJustSym0 l
- type IsJustSym1 t = IsJust t
- data IsNothingSym0 l
- type IsNothingSym1 t = IsNothing t
- data FromJustSym0 l
- type FromJustSym1 t = FromJust t
- data FromMaybeSym0 l
- data FromMaybeSym1 l l
- type FromMaybeSym2 t t = FromMaybe t t
- data ListToMaybeSym0 l
- type ListToMaybeSym1 t = ListToMaybe t
- data MaybeToListSym0 l
- type MaybeToListSym1 t = MaybeToList t
- data CatMaybesSym0 l
- type CatMaybesSym1 t = CatMaybes t
- data MapMaybeSym0 l
- data MapMaybeSym1 l l
- type MapMaybeSym2 t t = MapMaybe t t
Documentation
The singleton kind-indexed data family.
data Sing Bool where Source | |
data Sing Ordering where Source | |
data Sing * where Source | |
data Sing Nat where Source | |
data Sing Symbol where
| |
data Sing () where Source | |
data Sing [a0] where Source | |
data Sing (Maybe a0) where Source | |
data Sing (TyFun k1 k2 -> *) = SLambda {} Source | |
data Sing (Either a0 b0) where Source | |
data Sing ((,) a0 b0) where Source | |
data Sing ((,,) a0 b0 c0) where Source | |
data Sing ((,,,) a0 b0 c0 d0) where Source | |
data Sing ((,,,,) a0 b0 c0 d0 e0) where Source | |
data Sing ((,,,,,) a0 b0 c0 d0 e0 f0) where Source | |
data Sing ((,,,,,,) a0 b0 c0 d0 e0 f0 g0) where Source |
Though Haddock doesn't show it, the Sing
instance above declares
constructors
SNothing :: Sing Nothing SJust :: Sing a -> Sing (Just a)
Singletons from Data.Maybe
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
.
sIsNothing :: forall t. Sing t -> Sing (Apply IsNothingSym0 t :: Bool) Source
type family FromMaybe a a :: a Source
FromMaybe d x = Case_1627668954 d x (Let1627668946Scrutinee_1627668866Sym2 d x) |
sFromMaybe :: forall t t. Sing t -> Sing t -> Sing (Apply (Apply FromMaybeSym0 t) t :: a) Source
type family ListToMaybe a :: Maybe a Source
ListToMaybe `[]` = NothingSym0 | |
ListToMaybe ((:) a _z_1627668927) = Apply JustSym0 a |
sListToMaybe :: forall t. Sing t -> Sing (Apply ListToMaybeSym0 t :: Maybe a) Source
type family MaybeToList a :: [a] Source
MaybeToList Nothing = `[]` | |
MaybeToList (Just x) = Apply (Apply (:$) x) `[]` |
sMaybeToList :: forall t. Sing t -> Sing (Apply MaybeToListSym0 t :: [a]) Source
sCatMaybes :: forall t. Sing t -> Sing (Apply CatMaybesSym0 t :: [a]) Source
Defunctionalization symbols
type NothingSym0 = Nothing Source
data Maybe_Sym0 l Source
SuppressUnusedWarnings (TyFun k (TyFun (TyFun k k -> *) (TyFun (Maybe k) k -> *) -> *) -> *) (Maybe_Sym0 k k) Source | |
type Apply (TyFun (TyFun k1 k -> *) (TyFun (Maybe k1) k -> *) -> *) k (Maybe_Sym0 k k1) l0 = Maybe_Sym1 k k1 l0 Source |
data Maybe_Sym1 l l Source
SuppressUnusedWarnings (k -> TyFun (TyFun k k -> *) (TyFun (Maybe k) k -> *) -> *) (Maybe_Sym1 k k) Source | |
type Apply (TyFun (Maybe k) k1 -> *) (TyFun k k1 -> *) (Maybe_Sym1 k1 k l1) l0 = Maybe_Sym2 k1 k l1 l0 Source |
data Maybe_Sym2 l l l Source
SuppressUnusedWarnings (k -> (TyFun k k -> *) -> TyFun (Maybe k) k -> *) (Maybe_Sym2 k k) Source | |
type Apply k (Maybe k1) (Maybe_Sym2 k k1 l1 l2) l0 = Maybe_Sym3 k k1 l1 l2 l0 Source |
type Maybe_Sym3 t t t = Maybe_ t t t Source
data IsJustSym0 l Source
SuppressUnusedWarnings (TyFun (Maybe k) Bool -> *) (IsJustSym0 k) Source | |
type Apply Bool (Maybe k) (IsJustSym0 k) l0 = IsJustSym1 k l0 Source |
type IsJustSym1 t = IsJust t Source
data IsNothingSym0 l Source
SuppressUnusedWarnings (TyFun (Maybe k) Bool -> *) (IsNothingSym0 k) Source | |
type Apply Bool (Maybe k) (IsNothingSym0 k) l0 = IsNothingSym1 k l0 Source |
type IsNothingSym1 t = IsNothing t Source
data FromJustSym0 l Source
SuppressUnusedWarnings (TyFun (Maybe k) k -> *) (FromJustSym0 k) Source | |
type Apply k (Maybe k) (FromJustSym0 k) l0 = FromJustSym1 k l0 Source |
type FromJustSym1 t = FromJust t Source
data FromMaybeSym0 l Source
SuppressUnusedWarnings (TyFun k (TyFun (Maybe k) k -> *) -> *) (FromMaybeSym0 k) Source | |
type Apply (TyFun (Maybe k) k -> *) k (FromMaybeSym0 k) l0 = FromMaybeSym1 k l0 Source |
data FromMaybeSym1 l l Source
SuppressUnusedWarnings (k -> TyFun (Maybe k) k -> *) (FromMaybeSym1 k) Source | |
type Apply k (Maybe k) (FromMaybeSym1 k l1) l0 = FromMaybeSym2 k l1 l0 Source |
type FromMaybeSym2 t t = FromMaybe t t Source
data ListToMaybeSym0 l Source
SuppressUnusedWarnings (TyFun [k] (Maybe k) -> *) (ListToMaybeSym0 k) Source | |
type Apply (Maybe k) [k] (ListToMaybeSym0 k) l0 = ListToMaybeSym1 k l0 Source |
type ListToMaybeSym1 t = ListToMaybe t Source
data MaybeToListSym0 l Source
SuppressUnusedWarnings (TyFun (Maybe k) [k] -> *) (MaybeToListSym0 k) Source | |
type Apply [k] (Maybe k) (MaybeToListSym0 k) l0 = MaybeToListSym1 k l0 Source |
type MaybeToListSym1 t = MaybeToList t Source
data CatMaybesSym0 l Source
SuppressUnusedWarnings (TyFun [Maybe k] [k] -> *) (CatMaybesSym0 k) Source | |
type Apply [k] [Maybe k] (CatMaybesSym0 k) l0 = CatMaybesSym1 k l0 Source |
type CatMaybesSym1 t = CatMaybes t Source
data MapMaybeSym0 l Source
SuppressUnusedWarnings (TyFun (TyFun k (Maybe k) -> *) (TyFun [k] [k] -> *) -> *) (MapMaybeSym0 k k) Source | |
type Apply (TyFun [k] [k1] -> *) (TyFun k (Maybe k1) -> *) (MapMaybeSym0 k k1) l0 = MapMaybeSym1 k k1 l0 Source |
data MapMaybeSym1 l l Source
SuppressUnusedWarnings ((TyFun k (Maybe k) -> *) -> TyFun [k] [k] -> *) (MapMaybeSym1 k k) Source | |
type Apply [k1] [k] (MapMaybeSym1 k k1 l1) l0 = MapMaybeSym2 k k1 l1 l0 Source |
type MapMaybeSym2 t t = MapMaybe t t Source