singletons-base-3.0: A promoted and singled version of the base library
Copyright(C) 2018 Ryan Scott
LicenseBSD-style (see LICENSE)
MaintainerRyan Scott
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Singletons.Base.TypeError

Description

Defines a drop-in replacement for TypeError (from GHC.TypeLits) that can be used at the value level as well. Since this is a drop-in replacement, it is not recommended to import all of GHC.TypeLits and Data.Singletons.Base.TypeError at the same time, as many of the definitions in the latter deliberately clash with the former.

Synopsis

Documentation

type family TypeError (x :: PErrorMessage) :: a where ... Source #

A drop-in replacement for TypeError. This also exists at the value-level as typeError.

sTypeError :: HasCallStack => Sing err -> Sing (TypeError err) Source #

The singleton for typeError.

Note that this is not quite as expressive as TypeError, as it is unable to handle ShowType constructors at all.

typeError :: HasCallStack => ErrorMessage -> a Source #

The value-level counterpart to TypeError.

Note that this is not quite as expressive as TypeError, as it is unable to print the contents of ShowType constructors (it will simply print "<type>" in their place).

data ErrorMessage' s Source #

A description of a custom type error.

This is a variation on ErrorMessage that is parameterized over what text type is used in the Text constructor. Instantiating it with Text gives you ErrorMessage, and instantiating it with Symbol gives you PErrorMessage.

Constructors

Text s

Show the text as is.

forall t. ShowType t

Pretty print the type. ShowType :: k -> ErrorMessage

(ErrorMessage' s) :<>: (ErrorMessage' s) infixl 6

Put two pieces of error message next to each other.

(ErrorMessage' s) :$$: (ErrorMessage' s) infixl 5

Stack two pieces of error message on top of each other.

Instances

Instances details
SingKind PErrorMessage Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Associated Types

type Demote PErrorMessage = (r :: Type) #

SingI t => SingI ('Text t :: ErrorMessage' Symbol) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ('Text t) #

SingI ty => SingI ('ShowType ty :: ErrorMessage' Symbol) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ('ShowType ty) #

(SingI e1, SingI e2) => SingI (e1 :<>: e2 :: ErrorMessage' Symbol) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (e1 :<>: e2) #

(SingI e1, SingI e2) => SingI (e1 :$$: e2 :: ErrorMessage' Symbol) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (e1 :$$: e2) #

SingI (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SingI (TextSym0 :: TyFun Symbol (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing TextSym0 #

SingI ((:$$:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (:$$:@#@$) #

SingI ((:<>:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (:<>:@#@$) #

SuppressUnusedWarnings (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SingI (ShowTypeSym0 :: TyFun t (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SingI x => SingI ((:$$:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ((:$$:@#@$$) x) #

SingI x => SingI ((:<>:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ((:<>:@#@$$) x) #

SuppressUnusedWarnings (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Sing Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Demote PErrorMessage Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679646232 :: PErrorMessage) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679646232 :: PErrorMessage) = TypeError a6989586621679646232 :: k2
type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679646222 :: s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679646222 :: s) = 'Text a6989586621679646222
type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679646224 :: t) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679646224 :: t) = 'ShowType a6989586621679646224 :: ErrorMessage' s
type Apply ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646227 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646227 :: ErrorMessage' s) = a6989586621679646226 :<>: a6989586621679646227
type Apply ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646230 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646230 :: ErrorMessage' s) = a6989586621679646229 :$$: a6989586621679646230
type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646226 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646226 :: ErrorMessage' s) = (:<>:@#@$$) a6989586621679646226
type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646229 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646229 :: ErrorMessage' s) = (:$$:@#@$$) a6989586621679646229

type ErrorMessage = ErrorMessage' Text Source #

A value-level ErrorMessage` which uses Text as its text type.

type PErrorMessage = ErrorMessage' Symbol Source #

A type-level ErrorMessage` which uses Symbol as its text kind.

type family Sing :: k -> Type #

The singleton kind-indexed type family.

Instances

Instances details
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SBool
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing Source # 
Instance details

Defined in GHC.TypeLits.Singletons.Internal

type Sing = SNat
type Sing Source # 
Instance details

Defined in GHC.TypeLits.Singletons.Internal

type Sing = SSymbol
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple0
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SVoid
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SAll
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SAny
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SList :: [a] -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SMaybe :: Maybe a -> Type
type Sing Source #

A choice of singleton for the kind TYPE rep (for some RuntimeRep rep), an instantiation of which is the famous kind Type.

Conceivably, one could generalize this instance to `Sing @k` for any kind k, and remove all other Sing instances. We don't adopt this design, however, since it is far more convenient in practice to work with explicit singleton values than TypeReps (for instance, TypeReps are more difficult to pattern match on, and require extra runtime checks).

We cannot produce explicit singleton values for everything in TYPE rep, however, since it is an open kind, so we reach for TypeRep in this one particular case.

Instance details

Defined in Data.Singletons.Base.TypeRepTYPE

type Sing = TypeRep :: TYPE rep -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SMin :: Min a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SMax :: Max a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SFirst :: First a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SLast :: Last a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SIdentity :: Identity a -> Type
type Sing Source # 
Instance details

Defined in Data.Monoid.Singletons

type Sing = SFirst :: First a -> Type
type Sing Source # 
Instance details

Defined in Data.Monoid.Singletons

type Sing = SLast :: Last a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SDual :: Dual a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SSum :: Sum a -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons.Internal

type Sing = SProduct :: Product a -> Type
type Sing Source # 
Instance details

Defined in Data.Ord.Singletons

type Sing = SDown :: Down a -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SNonEmpty :: NonEmpty a -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = SEither :: Either a b -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple2 :: (a, b) -> Type
type Sing Source # 
Instance details

Defined in Data.Semigroup.Singletons

type Sing = SArg :: Arg a b -> Type
type Sing Source # 
Instance details

Defined in Data.Proxy.Singletons

type Sing = SProxy :: Proxy t -> Type
type Sing 
Instance details

Defined in Data.Singletons

type Sing 
Instance details

Defined in Data.Singletons

type Sing = SLambda :: (k1 ~> k2) -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple3 :: (a, b, c) -> Type
type Sing Source # 
Instance details

Defined in Data.Functor.Const.Singletons

type Sing = SConst :: Const a b -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple4 :: (a, b, c, d) -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple5 :: (a, b, c, d, e) -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple6 :: (a, b, c, d, e, f) -> Type
type Sing Source # 
Instance details

Defined in Data.Singletons.Base.Instances

type Sing = STuple7 :: (a, b, c, d, e, f, g) -> Type

data SErrorMessage :: PErrorMessage -> Type where Source #

Constructors

SText :: Sing t -> SErrorMessage ('Text t) 
SShowType :: Sing ty -> SErrorMessage ('ShowType ty) 
(:%<>:) :: Sing e1 -> Sing e2 -> SErrorMessage (e1 :<>: e2) infixl 6 
(:%$$:) :: Sing e1 -> Sing e2 -> SErrorMessage (e1 :$$: e2) infixl 5 

showErrorMessage :: ErrorMessage -> String Source #

Convert an ErrorMessage into a human-readable String.

Defunctionalization symbols

data TextSym0 :: (~>) s (ErrorMessage' (s :: Type)) Source #

Instances

Instances details
SingI (TextSym0 :: TyFun Symbol (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing TextSym0 #

SuppressUnusedWarnings (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679646222 :: s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679646222 :: s) = 'Text a6989586621679646222

type family TextSym1 (a6989586621679646222 :: s) :: ErrorMessage' (s :: Type) where ... Source #

Equations

TextSym1 a6989586621679646222 = 'Text a6989586621679646222 

data ShowTypeSym0 :: (~>) t (ErrorMessage' (s :: Type)) Source #

Instances

Instances details
SingI (ShowTypeSym0 :: TyFun t (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679646224 :: t) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679646224 :: t) = 'ShowType a6989586621679646224 :: ErrorMessage' s

type family ShowTypeSym1 (a6989586621679646224 :: t) :: ErrorMessage' (s :: Type) where ... Source #

Equations

ShowTypeSym1 a6989586621679646224 = 'ShowType a6989586621679646224 

data (:<>:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))) infixl 6 Source #

Instances

Instances details
SingI ((:<>:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (:<>:@#@$) #

SuppressUnusedWarnings ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646226 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646226 :: ErrorMessage' s) = (:<>:@#@$$) a6989586621679646226

data (:<>:@#@$$) (a6989586621679646226 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)) infixl 6 Source #

Instances

Instances details
SingI x => SingI ((:<>:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ((:<>:@#@$$) x) #

SuppressUnusedWarnings ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646227 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:<>:@#@$$) a6989586621679646226 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646227 :: ErrorMessage' s) = a6989586621679646226 :<>: a6989586621679646227

type family (a6989586621679646226 :: ErrorMessage' s) :<>:@#@$$$ (a6989586621679646227 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ... infixl 6 Source #

Equations

a6989586621679646226 :<>:@#@$$$ a6989586621679646227 = '(:<>:) a6989586621679646226 a6989586621679646227 

data (:$$:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))) infixl 5 Source #

Instances

Instances details
SingI ((:$$:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing (:$$:@#@$) #

SuppressUnusedWarnings ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646229 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679646229 :: ErrorMessage' s) = (:$$:@#@$$) a6989586621679646229

data (:$$:@#@$$) (a6989586621679646229 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)) infixl 5 Source #

Instances

Instances details
SingI x => SingI ((:$$:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

Methods

sing :: Sing ((:$$:@#@$$) x) #

SuppressUnusedWarnings ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646230 :: ErrorMessage' s) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply ((:$$:@#@$$) a6989586621679646229 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679646230 :: ErrorMessage' s) = a6989586621679646229 :$$: a6989586621679646230

type family (a6989586621679646229 :: ErrorMessage' s) :$$:@#@$$$ (a6989586621679646230 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ... infixl 5 Source #

Equations

a6989586621679646229 :$$:@#@$$$ a6989586621679646230 = '(:$$:) a6989586621679646229 a6989586621679646230 

data TypeErrorSym0 :: (~>) PErrorMessage a Source #

Instances

Instances details
SingI (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

SuppressUnusedWarnings (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679646232 :: PErrorMessage) Source # 
Instance details

Defined in Data.Singletons.Base.TypeError

type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679646232 :: PErrorMessage) = TypeError a6989586621679646232 :: k2

type family TypeErrorSym1 (a6989586621679646232 :: PErrorMessage) :: a where ... Source #

Equations

TypeErrorSym1 a6989586621679646232 = TypeError a6989586621679646232