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.Either

Contents

Description

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

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

Synopsis

The Either singleton

data family Sing (a :: k) #

The singleton kind-indexed data family.

Instances

data Sing Bool # 
data Sing Bool where
data Sing Ordering # 
data Sing * # 
data Sing * where
data Sing Nat # 
data Sing Nat where
data Sing Symbol # 
data Sing Symbol where
data Sing () # 
data Sing () where
data Sing [a] # 
data Sing [a] where
data Sing (Maybe a) # 
data Sing (Maybe a) where
data Sing (NonEmpty a) # 
data Sing (NonEmpty a) where
data Sing (Either a b) # 
data Sing (Either a b) where
data Sing (a, b) # 
data Sing (a, b) where
data Sing ((~>) k1 k2) # 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a, b, c) # 
data Sing (a, b, c) where
data Sing (a, b, c, d) # 
data Sing (a, b, c, d) where
data Sing (a, b, c, d, e) # 
data Sing (a, b, c, d, e) where
data Sing (a, b, c, d, e, f) # 
data Sing (a, b, c, d, e, f) where
data Sing (a, b, c, d, e, f, g) # 
data Sing (a, b, c, d, e, f, g) where

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

SLeft  :: Sing a -> Sing (Left a)
SRight :: Sing b -> Sing (Right b)

type SEither = (Sing :: Either a b -> Type) #

SEither is a kind-restricted synonym for Sing: type SEither (a :: Either x y) = Sing a

Singletons from Data.Either

either_ :: (a -> c) -> (b -> c) -> Either a b -> c #

type family Either_ (a :: TyFun a c -> Type) (a :: TyFun b c -> Type) (a :: Either a b) :: c where ... #

Equations

Either_ f _z_1627834007 (Left x) = Apply f x 
Either_ _z_1627834011 g (Right y) = Apply g y 

sEither_ :: forall (t :: TyFun a c -> Type) (t :: TyFun b c -> Type) (t :: Either a b). Sing t -> Sing t -> Sing t -> Sing (Apply (Apply (Apply Either_Sym0 t) t) t :: c) #

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

type family Lefts (a :: [Either a b]) :: [a] where ... #

Equations

Lefts '[] = '[] 
Lefts ((:) (Left x) xs) = Apply (Apply (:$) x) (Apply LeftsSym0 xs) 
Lefts ((:) (Right _z_1627835194) xs) = Apply LeftsSym0 xs 

sLefts :: forall (t :: [Either a b]). Sing t -> Sing (Apply LeftsSym0 t :: [a]) #

type family Rights (a :: [Either a b]) :: [b] where ... #

Equations

Rights '[] = '[] 
Rights ((:) (Left _z_1627835182) xs) = Apply RightsSym0 xs 
Rights ((:) (Right x) xs) = Apply (Apply (:$) x) (Apply RightsSym0 xs) 

sRights :: forall (t :: [Either a b]). Sing t -> Sing (Apply RightsSym0 t :: [b]) #

type family PartitionEithers (a :: [Either a b]) :: ([a], [b]) where ... #

Equations

PartitionEithers a_1627835136 = Apply (Apply (Apply FoldrSym0 (Apply (Apply Either_Sym0 (Let1627835143LeftSym1 a_1627835136)) (Let1627835143RightSym1 a_1627835136))) (Apply (Apply Tuple2Sym0 '[]) '[])) a_1627835136 

sPartitionEithers :: forall (t :: [Either a b]). Sing t -> Sing (Apply PartitionEithersSym0 t :: ([a], [b])) #

type family IsLeft (a :: Either a b) :: Bool where ... #

Equations

IsLeft (Left _z_1627835130) = TrueSym0 
IsLeft (Right _z_1627835133) = FalseSym0 

sIsLeft :: forall (t :: Either a b). Sing t -> Sing (Apply IsLeftSym0 t :: Bool) #

type family IsRight (a :: Either a b) :: Bool where ... #

Equations

IsRight (Left _z_1627835120) = FalseSym0 
IsRight (Right _z_1627835123) = TrueSym0 

sIsRight :: forall (t :: Either a b). Sing t -> Sing (Apply IsRightSym0 t :: Bool) #

Defunctionalization symbols

data LeftSym0 (l :: TyFun a1627455901 (Either a1627455901 b1627455902)) #

Instances

SuppressUnusedWarnings (TyFun a1627455901 (Either a1627455901 b1627455902) -> *) (LeftSym0 a1627455901 b1627455902) # 

Methods

suppressUnusedWarnings :: Proxy (LeftSym0 a1627455901 b1627455902) t -> () #

type Apply a (Either a b1627455902) (LeftSym0 a b1627455902) l # 
type Apply a (Either a b1627455902) (LeftSym0 a b1627455902) l = Left a b1627455902 l

type LeftSym1 (t :: a1627455901) = Left t #

data RightSym0 (l :: TyFun b1627455902 (Either a1627455901 b1627455902)) #

Instances

SuppressUnusedWarnings (TyFun b1627455902 (Either a1627455901 b1627455902) -> *) (RightSym0 a1627455901 b1627455902) # 

Methods

suppressUnusedWarnings :: Proxy (RightSym0 a1627455901 b1627455902) t -> () #

type Apply b (Either a1627455901 b) (RightSym0 a1627455901 b) l # 
type Apply b (Either a1627455901 b) (RightSym0 a1627455901 b) l = Right a1627455901 b l

type RightSym1 (t :: b1627455902) = Right t #

data Either_Sym0 (l :: TyFun (TyFun a1627833983 c1627833984 -> Type) (TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) -> Type)) #

Instances

SuppressUnusedWarnings (TyFun (TyFun a1627833983 c1627833984 -> Type) (TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) -> Type) -> *) (Either_Sym0 a1627833983 b1627833985 c1627833984) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym0 a1627833983 b1627833985 c1627833984) t -> () #

type Apply (TyFun a1627833983 c1627833984 -> Type) (TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) -> Type) (Either_Sym0 a1627833983 b1627833985 c1627833984) l # 
type Apply (TyFun a1627833983 c1627833984 -> Type) (TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) -> Type) (Either_Sym0 a1627833983 b1627833985 c1627833984) l = Either_Sym1 a1627833983 b1627833985 c1627833984 l

data Either_Sym1 (l :: TyFun a1627833983 c1627833984 -> Type) (l :: TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type)) #

Instances

SuppressUnusedWarnings ((TyFun a1627833983 c1627833984 -> Type) -> TyFun (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) -> *) (Either_Sym1 a1627833983 b1627833985 c1627833984) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym1 a1627833983 b1627833985 c1627833984) t -> () #

type Apply (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) (Either_Sym1 a1627833983 b1627833985 c1627833984 l1) l2 # 
type Apply (TyFun b1627833985 c1627833984 -> Type) (TyFun (Either a1627833983 b1627833985) c1627833984 -> Type) (Either_Sym1 a1627833983 b1627833985 c1627833984 l1) l2 = Either_Sym2 a1627833983 b1627833985 c1627833984 l1 l2

data Either_Sym2 (l :: TyFun a1627833983 c1627833984 -> Type) (l :: TyFun b1627833985 c1627833984 -> Type) (l :: TyFun (Either a1627833983 b1627833985) c1627833984) #

Instances

SuppressUnusedWarnings ((TyFun a1627833983 c1627833984 -> Type) -> (TyFun b1627833985 c1627833984 -> Type) -> TyFun (Either a1627833983 b1627833985) c1627833984 -> *) (Either_Sym2 a1627833983 b1627833985 c1627833984) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym2 a1627833983 b1627833985 c1627833984) t -> () #

type Apply (Either a b) c (Either_Sym2 a b c l1 l2) l3 # 
type Apply (Either a b) c (Either_Sym2 a b c l1 l2) l3 = Either_ a b c l1 l2 l3

type Either_Sym3 (t :: TyFun a1627833983 c1627833984 -> Type) (t :: TyFun b1627833985 c1627833984 -> Type) (t :: Either a1627833983 b1627833985) = Either_ t t t #

data LeftsSym0 (l :: TyFun [Either a1627835095 b1627835096] [a1627835095]) #

Instances

SuppressUnusedWarnings (TyFun [Either a1627835095 b1627835096] [a1627835095] -> *) (LeftsSym0 b1627835096 a1627835095) # 

Methods

suppressUnusedWarnings :: Proxy (LeftsSym0 b1627835096 a1627835095) t -> () #

type Apply [Either a b] [a] (LeftsSym0 b a) l # 
type Apply [Either a b] [a] (LeftsSym0 b a) l = Lefts b a l

type LeftsSym1 (t :: [Either a1627835095 b1627835096]) = Lefts t #

data RightsSym0 (l :: TyFun [Either a1627835093 b1627835094] [b1627835094]) #

Instances

SuppressUnusedWarnings (TyFun [Either a1627835093 b1627835094] [b1627835094] -> *) (RightsSym0 a1627835093 b1627835094) # 

Methods

suppressUnusedWarnings :: Proxy (RightsSym0 a1627835093 b1627835094) t -> () #

type Apply [Either a b] [b] (RightsSym0 a b) l # 
type Apply [Either a b] [b] (RightsSym0 a b) l = Rights a b l

type RightsSym1 (t :: [Either a1627835093 b1627835094]) = Rights t #

data IsLeftSym0 (l :: TyFun (Either a1627835089 b1627835090) Bool) #

Instances

SuppressUnusedWarnings (TyFun (Either a1627835089 b1627835090) Bool -> *) (IsLeftSym0 a1627835089 b1627835090) # 

Methods

suppressUnusedWarnings :: Proxy (IsLeftSym0 a1627835089 b1627835090) t -> () #

type Apply (Either a b) Bool (IsLeftSym0 a b) l # 
type Apply (Either a b) Bool (IsLeftSym0 a b) l = IsLeft a b l

type IsLeftSym1 (t :: Either a1627835089 b1627835090) = IsLeft t #

data IsRightSym0 (l :: TyFun (Either a1627835087 b1627835088) Bool) #

Instances

SuppressUnusedWarnings (TyFun (Either a1627835087 b1627835088) Bool -> *) (IsRightSym0 a1627835087 b1627835088) # 

Methods

suppressUnusedWarnings :: Proxy (IsRightSym0 a1627835087 b1627835088) t -> () #

type Apply (Either a b) Bool (IsRightSym0 a b) l # 
type Apply (Either a b) Bool (IsRightSym0 a b) l = IsRight a b l

type IsRightSym1 (t :: Either a1627835087 b1627835088) = IsRight t #