singletons-2.4.1: A framework for generating singleton types

Copyright(C) 2014 Jan Stolarek
LicenseBSD-style (see LICENSE)
MaintainerJan Stolarek (jan.stolarek@p.lodz.pl)
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Promotion.Prelude.Maybe

Contents

Description

Defines promoted functions and datatypes relating to Maybe, including a promoted 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

Promoted functions from Data.Maybe

maybe_ :: b -> (a -> b) -> Maybe a -> b #

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

Equations

Maybe_ n _ Nothing = n 
Maybe_ _ f (Just x) = Apply f x 

The preceding two definitions is 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 ... #

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

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

Equations

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

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

Equations

FromMaybe d x = Case_6989586621679420830 d x x 

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

Equations

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

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

Equations

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

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

Equations

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

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

Equations

MapMaybe _ '[] = '[] 
MapMaybe f ((:) x xs) = Case_6989586621679420798 f x xs (Let6989586621679420785Scrutinee_6989586621679420628Sym3 f x xs) 

Defunctionalization symbols

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

Instances
SuppressUnusedWarnings (JustSym0 :: TyFun a3530822107858468865 (Maybe a3530822107858468865) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (JustSym0 :: TyFun a (Maybe a) -> *) (l :: a) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (JustSym0 :: TyFun a (Maybe a) -> *) (l :: a) = Just l

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

data Maybe_Sym0 (l :: TyFun b6989586621679419480 (TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> Type)) #

Instances
SuppressUnusedWarnings (Maybe_Sym0 :: TyFun b6989586621679419480 (TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym0 :: TyFun b6989586621679419480 (TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> Type) -> *) (l :: b6989586621679419480) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym0 :: TyFun b6989586621679419480 (TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> Type) -> *) (l :: b6989586621679419480) = (Maybe_Sym1 l :: TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> *)

data Maybe_Sym1 (l :: b6989586621679419480) (l :: TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type)) #

Instances
SuppressUnusedWarnings (Maybe_Sym1 :: b6989586621679419480 -> TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym1 l1 :: TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> *) (l2 :: TyFun a6989586621679419481 b6989586621679419480 -> Type) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym1 l1 :: TyFun (TyFun a6989586621679419481 b6989586621679419480 -> Type) (TyFun (Maybe a6989586621679419481) b6989586621679419480 -> Type) -> *) (l2 :: TyFun a6989586621679419481 b6989586621679419480 -> Type) = Maybe_Sym2 l1 l2

data Maybe_Sym2 (l :: b6989586621679419480) (l :: TyFun a6989586621679419481 b6989586621679419480 -> Type) (l :: TyFun (Maybe a6989586621679419481) b6989586621679419480) #

Instances
SuppressUnusedWarnings (Maybe_Sym2 :: b6989586621679419480 -> (TyFun a6989586621679419481 b6989586621679419480 -> Type) -> TyFun (Maybe a6989586621679419481) b6989586621679419480 -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym2 l1 l2 :: TyFun (Maybe a) b -> *) (l3 :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (Maybe_Sym2 l1 l2 :: TyFun (Maybe a) b -> *) (l3 :: Maybe a) = Maybe_ l1 l2 l3

type Maybe_Sym3 (t :: b6989586621679419480) (t :: TyFun a6989586621679419481 b6989586621679419480 -> Type) (t :: Maybe a6989586621679419481) = Maybe_ t t t #

data IsJustSym0 (l :: TyFun (Maybe a6989586621679420601) Bool) #

Instances
SuppressUnusedWarnings (IsJustSym0 :: TyFun (Maybe a6989586621679420601) Bool -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (IsJustSym0 :: TyFun (Maybe a) Bool -> *) (l :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (IsJustSym0 :: TyFun (Maybe a) Bool -> *) (l :: Maybe a) = IsJust l

type IsJustSym1 (t :: Maybe a6989586621679420601) = IsJust t #

data IsNothingSym0 (l :: TyFun (Maybe a6989586621679420600) Bool) #

Instances
SuppressUnusedWarnings (IsNothingSym0 :: TyFun (Maybe a6989586621679420600) Bool -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (IsNothingSym0 :: TyFun (Maybe a) Bool -> *) (l :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (IsNothingSym0 :: TyFun (Maybe a) Bool -> *) (l :: Maybe a) = IsNothing l

type IsNothingSym1 (t :: Maybe a6989586621679420600) = IsNothing t #

data FromJustSym0 (l :: TyFun (Maybe a6989586621679420599) a6989586621679420599) #

Instances
SuppressUnusedWarnings (FromJustSym0 :: TyFun (Maybe a6989586621679420599) a6989586621679420599 -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromJustSym0 :: TyFun (Maybe a) a -> *) (l :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromJustSym0 :: TyFun (Maybe a) a -> *) (l :: Maybe a) = FromJust l

type FromJustSym1 (t :: Maybe a6989586621679420599) = FromJust t #

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

Instances
SuppressUnusedWarnings (FromMaybeSym0 :: TyFun a6989586621679420598 (TyFun (Maybe a6989586621679420598) a6989586621679420598 -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromMaybeSym0 :: TyFun a6989586621679420598 (TyFun (Maybe a6989586621679420598) a6989586621679420598 -> Type) -> *) (l :: a6989586621679420598) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromMaybeSym0 :: TyFun a6989586621679420598 (TyFun (Maybe a6989586621679420598) a6989586621679420598 -> Type) -> *) (l :: a6989586621679420598) = FromMaybeSym1 l

data FromMaybeSym1 (l :: a6989586621679420598) (l :: TyFun (Maybe a6989586621679420598) a6989586621679420598) #

Instances
SuppressUnusedWarnings (FromMaybeSym1 :: a6989586621679420598 -> TyFun (Maybe a6989586621679420598) a6989586621679420598 -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromMaybeSym1 l1 :: TyFun (Maybe a) a -> *) (l2 :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (FromMaybeSym1 l1 :: TyFun (Maybe a) a -> *) (l2 :: Maybe a) = FromMaybe l1 l2

type FromMaybeSym2 (t :: a6989586621679420598) (t :: Maybe a6989586621679420598) = FromMaybe t t #

data MaybeToListSym0 (l :: TyFun (Maybe a6989586621679420597) [a6989586621679420597]) #

Instances
SuppressUnusedWarnings (MaybeToListSym0 :: TyFun (Maybe a6989586621679420597) [a6989586621679420597] -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MaybeToListSym0 :: TyFun (Maybe a) [a] -> *) (l :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MaybeToListSym0 :: TyFun (Maybe a) [a] -> *) (l :: Maybe a) = MaybeToList l

type MaybeToListSym1 (t :: Maybe a6989586621679420597) = MaybeToList t #

data ListToMaybeSym0 (l :: TyFun [a6989586621679420596] (Maybe a6989586621679420596)) #

Instances
SuppressUnusedWarnings (ListToMaybeSym0 :: TyFun [a6989586621679420596] (Maybe a6989586621679420596) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (ListToMaybeSym0 :: TyFun [a] (Maybe a) -> *) (l :: [a]) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (ListToMaybeSym0 :: TyFun [a] (Maybe a) -> *) (l :: [a]) = ListToMaybe l

type ListToMaybeSym1 (t :: [a6989586621679420596]) = ListToMaybe t #

data CatMaybesSym0 (l :: TyFun [Maybe a6989586621679420595] [a6989586621679420595]) #

Instances
SuppressUnusedWarnings (CatMaybesSym0 :: TyFun [Maybe a6989586621679420595] [a6989586621679420595] -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (CatMaybesSym0 :: TyFun [Maybe a] [a] -> *) (l :: [Maybe a]) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (CatMaybesSym0 :: TyFun [Maybe a] [a] -> *) (l :: [Maybe a]) = CatMaybes l

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

data MapMaybeSym0 (l :: TyFun (TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (TyFun [a6989586621679420593] [b6989586621679420594] -> Type)) #

Instances
SuppressUnusedWarnings (MapMaybeSym0 :: TyFun (TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (TyFun [a6989586621679420593] [b6989586621679420594] -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MapMaybeSym0 :: TyFun (TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (TyFun [a6989586621679420593] [b6989586621679420594] -> Type) -> *) (l :: TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MapMaybeSym0 :: TyFun (TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (TyFun [a6989586621679420593] [b6989586621679420594] -> Type) -> *) (l :: TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) = MapMaybeSym1 l

data MapMaybeSym1 (l :: TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (l :: TyFun [a6989586621679420593] [b6989586621679420594]) #

Instances
SuppressUnusedWarnings (MapMaybeSym1 :: (TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) -> TyFun [a6989586621679420593] [b6989586621679420594] -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MapMaybeSym1 l1 :: TyFun [a] [b] -> *) (l2 :: [a]) # 
Instance details

Defined in Data.Singletons.Prelude.Maybe

type Apply (MapMaybeSym1 l1 :: TyFun [a] [b] -> *) (l2 :: [a]) = MapMaybe l1 l2

type MapMaybeSym2 (t :: TyFun a6989586621679420593 (Maybe b6989586621679420594) -> Type) (t :: [a6989586621679420593]) = MapMaybe t t #