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.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 [a0] # 
data Sing [a0] where
data Sing (Maybe a0) # 
data Sing (Maybe a0) where
data Sing (NonEmpty a0) # 
data Sing (NonEmpty a0) where
data Sing (Either a0 b0) # 
data Sing (Either a0 b0) where
data Sing (a0, b0) # 
data Sing (a0, b0) where
data Sing ((~>) k1 k2) # 
data Sing ((~>) k1 k2) = SLambda {}
data Sing (a0, b0, c0) # 
data Sing (a0, b0, c0) where
data Sing (a0, b0, c0, d0) # 
data Sing (a0, b0, c0, d0) where
data Sing (a0, b0, c0, d0, e0) # 
data Sing (a0, b0, c0, d0, e0) where
data Sing (a0, b0, c0, d0, e0, f0) # 
data Sing (a0, b0, c0, d0, e0, f0) where
data Sing (a0, b0, c0, d0, e0, f0, g0) # 
data Sing (a0, b0, c0, d0, e0, f0, g0) 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_ :: forall a c b. (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_6989586621679667687 (Left x) = Apply f x 
Either_ _z_6989586621679667691 g (Right y) = Apply g y 

sEither_ :: forall t t t. 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_6989586621679669032) xs) = Apply LeftsSym0 xs 

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

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

Equations

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

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

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

Equations

PartitionEithers a_6989586621679668974 = Apply (Apply (Apply FoldrSym0 (Apply (Apply Either_Sym0 (Let6989586621679668981LeftSym1 a_6989586621679668974)) (Let6989586621679668981RightSym1 a_6989586621679668974))) (Apply (Apply Tuple2Sym0 '[]) '[])) a_6989586621679668974 

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

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

Equations

IsLeft (Left _z_6989586621679668968) = TrueSym0 
IsLeft (Right _z_6989586621679668971) = FalseSym0 

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

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

Equations

IsRight (Left _z_6989586621679668958) = FalseSym0 
IsRight (Right _z_6989586621679668961) = TrueSym0 

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

Defunctionalization symbols

data LeftSym0 l #

Instances

SuppressUnusedWarnings (TyFun a6989586621679054100 (Either a6989586621679054100 b6989586621679054101) -> *) (LeftSym0 a6989586621679054100 b6989586621679054101) # 

Methods

suppressUnusedWarnings :: Proxy (LeftSym0 a6989586621679054100 b6989586621679054101) t -> () #

type Apply a6989586621679054100 (Either a6989586621679054100 b6989586621679054101) (LeftSym0 a6989586621679054100 b6989586621679054101) l0 # 
type Apply a6989586621679054100 (Either a6989586621679054100 b6989586621679054101) (LeftSym0 a6989586621679054100 b6989586621679054101) l0 = LeftSym1 b6989586621679054101 a6989586621679054100 l0

type LeftSym1 t = Left t #

data RightSym0 l #

Instances

SuppressUnusedWarnings (TyFun b6989586621679054101 (Either a6989586621679054100 b6989586621679054101) -> *) (RightSym0 a6989586621679054100 b6989586621679054101) # 

Methods

suppressUnusedWarnings :: Proxy (RightSym0 a6989586621679054100 b6989586621679054101) t -> () #

type Apply b6989586621679054101 (Either a6989586621679054100 b6989586621679054101) (RightSym0 a6989586621679054100 b6989586621679054101) l0 # 
type Apply b6989586621679054101 (Either a6989586621679054100 b6989586621679054101) (RightSym0 a6989586621679054100 b6989586621679054101) l0 = RightSym1 a6989586621679054100 b6989586621679054101 l0

type RightSym1 t = Right t #

data Either_Sym0 l #

Instances

SuppressUnusedWarnings (TyFun (TyFun a6989586621679667663 c6989586621679667664 -> Type) (TyFun (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) -> Type) -> *) (Either_Sym0 a6989586621679667663 b6989586621679667665 c6989586621679667664) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym0 a6989586621679667663 b6989586621679667665 c6989586621679667664) t -> () #

type Apply (TyFun a6989586621679667663 c6989586621679667664 -> Type) (TyFun (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) -> Type) (Either_Sym0 a6989586621679667663 b6989586621679667665 c6989586621679667664) l0 # 
type Apply (TyFun a6989586621679667663 c6989586621679667664 -> Type) (TyFun (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) -> Type) (Either_Sym0 a6989586621679667663 b6989586621679667665 c6989586621679667664) l0 = Either_Sym1 b6989586621679667665 a6989586621679667663 c6989586621679667664 l0

data Either_Sym1 l l #

Instances

SuppressUnusedWarnings ((TyFun a6989586621679667663 c6989586621679667664 -> Type) -> TyFun (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) -> *) (Either_Sym1 b6989586621679667665 a6989586621679667663 c6989586621679667664) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym1 b6989586621679667665 a6989586621679667663 c6989586621679667664) t -> () #

type Apply (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) (Either_Sym1 b6989586621679667665 a6989586621679667663 c6989586621679667664 l0) l1 # 
type Apply (TyFun b6989586621679667665 c6989586621679667664 -> Type) (TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> Type) (Either_Sym1 b6989586621679667665 a6989586621679667663 c6989586621679667664 l0) l1 = Either_Sym2 b6989586621679667665 a6989586621679667663 c6989586621679667664 l0 l1

data Either_Sym2 l l l #

Instances

SuppressUnusedWarnings ((TyFun a6989586621679667663 c6989586621679667664 -> Type) -> (TyFun b6989586621679667665 c6989586621679667664 -> Type) -> TyFun (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 -> *) (Either_Sym2 b6989586621679667665 a6989586621679667663 c6989586621679667664) # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym2 b6989586621679667665 a6989586621679667663 c6989586621679667664) t -> () #

type Apply (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 (Either_Sym2 b6989586621679667665 a6989586621679667663 c6989586621679667664 l1 l0) l2 # 
type Apply (Either a6989586621679667663 b6989586621679667665) c6989586621679667664 (Either_Sym2 b6989586621679667665 a6989586621679667663 c6989586621679667664 l1 l0) l2 = Either_Sym3 b6989586621679667665 a6989586621679667663 c6989586621679667664 l1 l0 l2

type Either_Sym3 t t t = Either_ t t t #

data LeftsSym0 l #

Instances

SuppressUnusedWarnings (TyFun [Either a6989586621679668933 b6989586621679668934] [a6989586621679668933] -> *) (LeftsSym0 b6989586621679668934 a6989586621679668933) # 

Methods

suppressUnusedWarnings :: Proxy (LeftsSym0 b6989586621679668934 a6989586621679668933) t -> () #

type Apply [Either a6989586621679668933 b6989586621679668934] [a6989586621679668933] (LeftsSym0 b6989586621679668934 a6989586621679668933) l0 # 
type Apply [Either a6989586621679668933 b6989586621679668934] [a6989586621679668933] (LeftsSym0 b6989586621679668934 a6989586621679668933) l0 = LeftsSym1 a6989586621679668933 b6989586621679668934 l0

type LeftsSym1 t = Lefts t #

data RightsSym0 l #

Instances

SuppressUnusedWarnings (TyFun [Either a6989586621679668931 b6989586621679668932] [b6989586621679668932] -> *) (RightsSym0 a6989586621679668931 b6989586621679668932) # 

Methods

suppressUnusedWarnings :: Proxy (RightsSym0 a6989586621679668931 b6989586621679668932) t -> () #

type Apply [Either a6989586621679668931 b6989586621679668932] [b6989586621679668932] (RightsSym0 a6989586621679668931 b6989586621679668932) l0 # 
type Apply [Either a6989586621679668931 b6989586621679668932] [b6989586621679668932] (RightsSym0 a6989586621679668931 b6989586621679668932) l0 = RightsSym1 a6989586621679668931 b6989586621679668932 l0

type RightsSym1 t = Rights t #

data IsLeftSym0 l #

Instances

SuppressUnusedWarnings (TyFun (Either a6989586621679668927 b6989586621679668928) Bool -> *) (IsLeftSym0 a6989586621679668927 b6989586621679668928) # 

Methods

suppressUnusedWarnings :: Proxy (IsLeftSym0 a6989586621679668927 b6989586621679668928) t -> () #

type Apply (Either a6989586621679668927 b6989586621679668928) Bool (IsLeftSym0 a6989586621679668927 b6989586621679668928) l0 # 
type Apply (Either a6989586621679668927 b6989586621679668928) Bool (IsLeftSym0 a6989586621679668927 b6989586621679668928) l0 = IsLeftSym1 a6989586621679668927 b6989586621679668928 l0

type IsLeftSym1 t = IsLeft t #

data IsRightSym0 l #

Instances

SuppressUnusedWarnings (TyFun (Either a6989586621679668925 b6989586621679668926) Bool -> *) (IsRightSym0 a6989586621679668925 b6989586621679668926) # 

Methods

suppressUnusedWarnings :: Proxy (IsRightSym0 a6989586621679668925 b6989586621679668926) t -> () #

type Apply (Either a6989586621679668925 b6989586621679668926) Bool (IsRightSym0 a6989586621679668925 b6989586621679668926) l0 # 
type Apply (Either a6989586621679668925 b6989586621679668926) Bool (IsRightSym0 a6989586621679668925 b6989586621679668926) l0 = IsRightSym1 a6989586621679668925 b6989586621679668926 l0

type IsRightSym1 t = IsRight t #