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) 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

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

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

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 Source #

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

Equations

Either_ f _z_6989586621679436313 (Left x) = Apply f x 
Either_ _z_6989586621679436317 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) Source #

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 ... Source #

Equations

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

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

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

Equations

Rights '[] = '[] 
Rights ((:) (Left _z_6989586621679437488) 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]) Source #

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

Equations

PartitionEithers a_6989586621679437442 = Apply (Apply (Apply FoldrSym0 (Apply (Apply Either_Sym0 (Let6989586621679437449LeftSym1 a_6989586621679437442)) (Let6989586621679437449RightSym1 a_6989586621679437442))) (Apply (Apply Tuple2Sym0 '[]) '[])) a_6989586621679437442 

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

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

Equations

IsLeft (Left _z_6989586621679437436) = TrueSym0 
IsLeft (Right _z_6989586621679437439) = FalseSym0 

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

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

Equations

IsRight (Left _z_6989586621679437426) = FalseSym0 
IsRight (Right _z_6989586621679437429) = TrueSym0 

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

Defunctionalization symbols

data LeftSym0 (l :: TyFun a6989586621679075399 (Either a6989586621679075399 b6989586621679075400)) Source #

Instances

SuppressUnusedWarnings (TyFun a6989586621679075399 (Either a6989586621679075399 b6989586621679075400) -> *) (LeftSym0 a6989586621679075399 b6989586621679075400) Source # 

Methods

suppressUnusedWarnings :: Proxy (LeftSym0 a6989586621679075399 b6989586621679075400) t -> () Source #

type Apply a (Either a b6989586621679075400) (LeftSym0 a b6989586621679075400) l Source # 
type Apply a (Either a b6989586621679075400) (LeftSym0 a b6989586621679075400) l = Left a b6989586621679075400 l

type LeftSym1 (t :: a6989586621679075399) = Left t Source #

data RightSym0 (l :: TyFun b6989586621679075400 (Either a6989586621679075399 b6989586621679075400)) Source #

Instances

SuppressUnusedWarnings (TyFun b6989586621679075400 (Either a6989586621679075399 b6989586621679075400) -> *) (RightSym0 a6989586621679075399 b6989586621679075400) Source # 

Methods

suppressUnusedWarnings :: Proxy (RightSym0 a6989586621679075399 b6989586621679075400) t -> () Source #

type Apply b (Either a6989586621679075399 b) (RightSym0 a6989586621679075399 b) l Source # 
type Apply b (Either a6989586621679075399 b) (RightSym0 a6989586621679075399 b) l = Right a6989586621679075399 b l

type RightSym1 (t :: b6989586621679075400) = Right t Source #

data Either_Sym0 (l :: TyFun (TyFun a6989586621679436289 c6989586621679436290 -> Type) (TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) -> Type)) Source #

Instances

SuppressUnusedWarnings (TyFun (TyFun a6989586621679436289 c6989586621679436290 -> Type) (TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) -> Type) -> *) (Either_Sym0 a6989586621679436289 b6989586621679436291 c6989586621679436290) Source # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym0 a6989586621679436289 b6989586621679436291 c6989586621679436290) t -> () Source #

type Apply (TyFun a6989586621679436289 c6989586621679436290 -> Type) (TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) -> Type) (Either_Sym0 a6989586621679436289 b6989586621679436291 c6989586621679436290) l Source # 
type Apply (TyFun a6989586621679436289 c6989586621679436290 -> Type) (TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) -> Type) (Either_Sym0 a6989586621679436289 b6989586621679436291 c6989586621679436290) l = Either_Sym1 a6989586621679436289 b6989586621679436291 c6989586621679436290 l

data Either_Sym1 (l :: TyFun a6989586621679436289 c6989586621679436290 -> Type) (l :: TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type)) Source #

Instances

SuppressUnusedWarnings ((TyFun a6989586621679436289 c6989586621679436290 -> Type) -> TyFun (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) -> *) (Either_Sym1 a6989586621679436289 b6989586621679436291 c6989586621679436290) Source # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym1 a6989586621679436289 b6989586621679436291 c6989586621679436290) t -> () Source #

type Apply (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) (Either_Sym1 a6989586621679436289 b6989586621679436291 c6989586621679436290 l1) l2 Source # 
type Apply (TyFun b6989586621679436291 c6989586621679436290 -> Type) (TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> Type) (Either_Sym1 a6989586621679436289 b6989586621679436291 c6989586621679436290 l1) l2 = Either_Sym2 a6989586621679436289 b6989586621679436291 c6989586621679436290 l1 l2

data Either_Sym2 (l :: TyFun a6989586621679436289 c6989586621679436290 -> Type) (l :: TyFun b6989586621679436291 c6989586621679436290 -> Type) (l :: TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290) Source #

Instances

SuppressUnusedWarnings ((TyFun a6989586621679436289 c6989586621679436290 -> Type) -> (TyFun b6989586621679436291 c6989586621679436290 -> Type) -> TyFun (Either a6989586621679436289 b6989586621679436291) c6989586621679436290 -> *) (Either_Sym2 a6989586621679436289 b6989586621679436291 c6989586621679436290) Source # 

Methods

suppressUnusedWarnings :: Proxy (Either_Sym2 a6989586621679436289 b6989586621679436291 c6989586621679436290) t -> () Source #

type Apply (Either a b) c (Either_Sym2 a b c l1 l2) l3 Source # 
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 a6989586621679436289 c6989586621679436290 -> Type) (t :: TyFun b6989586621679436291 c6989586621679436290 -> Type) (t :: Either a6989586621679436289 b6989586621679436291) = Either_ t t t Source #

data LeftsSym0 (l :: TyFun [Either a6989586621679437401 b6989586621679437402] [a6989586621679437401]) Source #

Instances

SuppressUnusedWarnings (TyFun [Either a6989586621679437401 b6989586621679437402] [a6989586621679437401] -> *) (LeftsSym0 b6989586621679437402 a6989586621679437401) Source # 

Methods

suppressUnusedWarnings :: Proxy (LeftsSym0 b6989586621679437402 a6989586621679437401) t -> () Source #

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

type LeftsSym1 (t :: [Either a6989586621679437401 b6989586621679437402]) = Lefts t Source #

data RightsSym0 (l :: TyFun [Either a6989586621679437399 b6989586621679437400] [b6989586621679437400]) Source #

Instances

SuppressUnusedWarnings (TyFun [Either a6989586621679437399 b6989586621679437400] [b6989586621679437400] -> *) (RightsSym0 a6989586621679437399 b6989586621679437400) Source # 

Methods

suppressUnusedWarnings :: Proxy (RightsSym0 a6989586621679437399 b6989586621679437400) t -> () Source #

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

type RightsSym1 (t :: [Either a6989586621679437399 b6989586621679437400]) = Rights t Source #

data IsLeftSym0 (l :: TyFun (Either a6989586621679437395 b6989586621679437396) Bool) Source #

Instances

SuppressUnusedWarnings (TyFun (Either a6989586621679437395 b6989586621679437396) Bool -> *) (IsLeftSym0 a6989586621679437395 b6989586621679437396) Source # 

Methods

suppressUnusedWarnings :: Proxy (IsLeftSym0 a6989586621679437395 b6989586621679437396) t -> () Source #

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

type IsLeftSym1 (t :: Either a6989586621679437395 b6989586621679437396) = IsLeft t Source #

data IsRightSym0 (l :: TyFun (Either a6989586621679437393 b6989586621679437394) Bool) Source #

Instances

SuppressUnusedWarnings (TyFun (Either a6989586621679437393 b6989586621679437394) Bool -> *) (IsRightSym0 a6989586621679437393 b6989586621679437394) Source # 

Methods

suppressUnusedWarnings :: Proxy (IsRightSym0 a6989586621679437393 b6989586621679437394) t -> () Source #

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

type IsRightSym1 (t :: Either a6989586621679437393 b6989586621679437394) = IsRight t Source #