singletons-2.4.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
SDecide k => TestCoercion (Sing :: k -> *) # 
Instance details

Defined in Data.Singletons.Decide

Methods

testCoercion :: Sing a -> Sing b -> Maybe (Coercion a b) #

SDecide k => TestEquality (Sing :: k -> *) # 
Instance details

Defined in Data.Singletons.Decide

Methods

testEquality :: Sing a -> Sing b -> Maybe (a :~: b) #

Show (SSymbol s) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> SSymbol s -> ShowS #

show :: SSymbol s -> String #

showList :: [SSymbol s] -> ShowS #

Show (SNat n) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> SNat n -> ShowS #

show :: SNat n -> String #

showList :: [SNat n] -> ShowS #

Eq (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

(==) :: Sing a -> Sing a -> Bool #

(/=) :: Sing a -> Sing a -> Bool #

Ord (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

compare :: Sing a -> Sing a -> Ordering #

(<) :: Sing a -> Sing a -> Bool #

(<=) :: Sing a -> Sing a -> Bool #

(>) :: Sing a -> Sing a -> Bool #

(>=) :: Sing a -> Sing a -> Bool #

max :: Sing a -> Sing a -> Sing a #

min :: Sing a -> Sing a -> Sing a #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing [a]) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

ShowSing a => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing a) # 
Instance details

Defined in Data.Singletons.TypeRepStar

Methods

showsPrec :: Int -> Sing a -> ShowS #

show :: Sing a -> String #

showList :: [Sing a] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e, ShowSing f) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing b, ShowSing c, ShowSing d, ShowSing e, ShowSing f, ShowSing g) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

(ShowSing a, ShowSing [a]) => Show (Sing z) # 
Instance details

Defined in Data.Singletons.ShowSing

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

data Sing (z :: Bool) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Bool) where
data Sing (z :: Ordering) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Ordering) where
data Sing (a :: Type) # 
Instance details

Defined in Data.Singletons.TypeRepStar

data Sing (a :: Type) = STypeRep (TypeRep a)
data Sing (n :: Nat) # 
Instance details

Defined in Data.Singletons.TypeLits.Internal

data Sing (n :: Nat) where
data Sing (n :: Symbol) # 
Instance details

Defined in Data.Singletons.TypeLits.Internal

data Sing (n :: Symbol) where
data Sing (z :: ()) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: ()) where
data Sing (z :: Void) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Void)
data Sing (z :: [a]) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: [a]) where
data Sing (z :: Maybe a) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Maybe a) where
data Sing (z :: NonEmpty a) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: NonEmpty a) where
data Sing (z :: Either a b) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: Either a b) where
data Sing (z :: (a, b)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b)) where
data Sing (f :: k1 ~> k2) # 
Instance details

Defined in Data.Singletons.Internal

data Sing (f :: k1 ~> k2) = SLambda {}
data Sing (z :: (a, b, c)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c)) where
data Sing (z :: (a, b, c, d)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d)) where
data Sing (z :: (a, b, c, d, e)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d, e)) where
data Sing (z :: (a, b, c, d, e, f)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (a, b, c, d, e, f)) where
data Sing (z :: (a, b, c, d, e, f, g)) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

data Sing (z :: (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 _ (Left x) = Apply f x 
Either_ _ 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 _) 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 _) 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_6989586621679941346 = Apply (Apply (Apply FoldrSym0 (Apply (Apply Either_Sym0 (Let6989586621679941353LeftSym1 a_6989586621679941346)) (Let6989586621679941353RightSym1 a_6989586621679941346))) (Apply (Apply Tuple2Sym0 '[]) '[])) a_6989586621679941346 

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 _) = TrueSym0 
IsLeft (Right _) = 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 _) = FalseSym0 
IsRight (Right _) = TrueSym0 

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

Defunctionalization symbols

data LeftSym0 (l :: TyFun a6989586621679083011 (Either a6989586621679083011 b6989586621679083012)) #

Instances
SuppressUnusedWarnings (LeftSym0 :: TyFun a6989586621679083011 (Either a6989586621679083011 b6989586621679083012) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (LeftSym0 :: TyFun a (Either a b6989586621679083012) -> *) (l :: a) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (LeftSym0 :: TyFun a (Either a b6989586621679083012) -> *) (l :: a) = (Left l :: Either a b6989586621679083012)

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

data RightSym0 (l :: TyFun b6989586621679083012 (Either a6989586621679083011 b6989586621679083012)) #

Instances
SuppressUnusedWarnings (RightSym0 :: TyFun b6989586621679083012 (Either a6989586621679083011 b6989586621679083012) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (RightSym0 :: TyFun b (Either a6989586621679083011 b) -> *) (l :: b) # 
Instance details

Defined in Data.Singletons.Prelude.Instances

type Apply (RightSym0 :: TyFun b (Either a6989586621679083011 b) -> *) (l :: b) = (Right l :: Either a6989586621679083011 b)

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

data Either_Sym0 (l :: TyFun (TyFun a6989586621679939843 c6989586621679939844 -> Type) (TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> Type)) #

Instances
SuppressUnusedWarnings (Either_Sym0 :: TyFun (TyFun a6989586621679939843 c6989586621679939844 -> Type) (TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym0 :: TyFun (TyFun a6989586621679939843 c6989586621679939844 -> Type) (TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> Type) -> *) (l :: TyFun a6989586621679939843 c6989586621679939844 -> Type) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym0 :: TyFun (TyFun a6989586621679939843 c6989586621679939844 -> Type) (TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> Type) -> *) (l :: TyFun a6989586621679939843 c6989586621679939844 -> Type) = (Either_Sym1 l :: TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> *)

data Either_Sym1 (l :: TyFun a6989586621679939843 c6989586621679939844 -> Type) (l :: TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type)) #

Instances
SuppressUnusedWarnings (Either_Sym1 :: (TyFun a6989586621679939843 c6989586621679939844 -> Type) -> TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym1 l1 :: TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> *) (l2 :: TyFun b6989586621679939845 c6989586621679939844 -> Type) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym1 l1 :: TyFun (TyFun b6989586621679939845 c6989586621679939844 -> Type) (TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> Type) -> *) (l2 :: TyFun b6989586621679939845 c6989586621679939844 -> Type) = Either_Sym2 l1 l2

data Either_Sym2 (l :: TyFun a6989586621679939843 c6989586621679939844 -> Type) (l :: TyFun b6989586621679939845 c6989586621679939844 -> Type) (l :: TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844) #

Instances
SuppressUnusedWarnings (Either_Sym2 :: (TyFun a6989586621679939843 c6989586621679939844 -> Type) -> (TyFun b6989586621679939845 c6989586621679939844 -> Type) -> TyFun (Either a6989586621679939843 b6989586621679939845) c6989586621679939844 -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym2 l1 l2 :: TyFun (Either a b) c -> *) (l3 :: Either a b) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (Either_Sym2 l1 l2 :: TyFun (Either a b) c -> *) (l3 :: Either a b) = Either_ l1 l2 l3

type Either_Sym3 (t :: TyFun a6989586621679939843 c6989586621679939844 -> Type) (t :: TyFun b6989586621679939845 c6989586621679939844 -> Type) (t :: Either a6989586621679939843 b6989586621679939845) = Either_ t t t #

data LeftsSym0 (l :: TyFun [Either a6989586621679940979 b6989586621679940980] [a6989586621679940979]) #

Instances
SuppressUnusedWarnings (LeftsSym0 :: TyFun [Either a6989586621679940979 b6989586621679940980] [a6989586621679940979] -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (LeftsSym0 :: TyFun [Either a b] [a] -> *) (l :: [Either a b]) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (LeftsSym0 :: TyFun [Either a b] [a] -> *) (l :: [Either a b]) = Lefts l

type LeftsSym1 (t :: [Either a6989586621679940979 b6989586621679940980]) = Lefts t #

data RightsSym0 (l :: TyFun [Either a6989586621679940977 b6989586621679940978] [b6989586621679940978]) #

Instances
SuppressUnusedWarnings (RightsSym0 :: TyFun [Either a6989586621679940977 b6989586621679940978] [b6989586621679940978] -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (RightsSym0 :: TyFun [Either a b] [b] -> *) (l :: [Either a b]) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (RightsSym0 :: TyFun [Either a b] [b] -> *) (l :: [Either a b]) = Rights l

type RightsSym1 (t :: [Either a6989586621679940977 b6989586621679940978]) = Rights t #

data IsLeftSym0 (l :: TyFun (Either a6989586621679940973 b6989586621679940974) Bool) #

Instances
SuppressUnusedWarnings (IsLeftSym0 :: TyFun (Either a6989586621679940973 b6989586621679940974) Bool -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (IsLeftSym0 :: TyFun (Either a b) Bool -> *) (l :: Either a b) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (IsLeftSym0 :: TyFun (Either a b) Bool -> *) (l :: Either a b) = IsLeft l

type IsLeftSym1 (t :: Either a6989586621679940973 b6989586621679940974) = IsLeft t #

data IsRightSym0 (l :: TyFun (Either a6989586621679940971 b6989586621679940972) Bool) #

Instances
SuppressUnusedWarnings (IsRightSym0 :: TyFun (Either a6989586621679940971 b6989586621679940972) Bool -> *) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (IsRightSym0 :: TyFun (Either a b) Bool -> *) (l :: Either a b) # 
Instance details

Defined in Data.Singletons.Prelude.Either

type Apply (IsRightSym0 :: TyFun (Either a b) Bool -> *) (l :: Either a b) = IsRight l

type IsRightSym1 (t :: Either a6989586621679940971 b6989586621679940972) = IsRight t #