| Copyright | (C) 2018 Ryan Scott |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | Ryan Scott |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Data.Singletons.Base.TypeError
Contents
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
- type family TypeError (x :: PErrorMessage) :: a where ...
- sTypeError :: HasCallStack => Sing err -> Sing (TypeError err)
- typeError :: HasCallStack => ErrorMessage -> a
- data ErrorMessage' s
- = Text s
- | forall t. ShowType t
- | (ErrorMessage' s) :<>: (ErrorMessage' s)
- | (ErrorMessage' s) :$$: (ErrorMessage' s)
- type ErrorMessage = ErrorMessage' Text
- type PErrorMessage = ErrorMessage' Symbol
- type family Sing :: k -> Type
- data SErrorMessage :: PErrorMessage -> Type where
- SText :: Sing t -> SErrorMessage ('Text t)
- SShowType :: Sing ty -> SErrorMessage ('ShowType ty)
- (:%<>:) :: Sing e1 -> Sing e2 -> SErrorMessage (e1 ':<>: e2)
- (:%$$:) :: Sing e1 -> Sing e2 -> SErrorMessage (e1 ':$$: e2)
- type family ConvertPErrorMessage (a :: PErrorMessage) :: ErrorMessage where ...
- showErrorMessage :: ErrorMessage -> String
- data TextSym0 :: (~>) s (ErrorMessage' (s :: Type))
- type family TextSym1 (a6989586621679682310 :: s) :: ErrorMessage' (s :: Type) where ...
- data ShowTypeSym0 :: (~>) t (ErrorMessage' (s :: Type))
- type family ShowTypeSym1 (a6989586621679682312 :: t) :: ErrorMessage' (s :: Type) where ...
- data (:<>:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)))
- data (:<>:@#@$$) (a6989586621679682314 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))
- type family (a6989586621679682314 :: ErrorMessage' s) :<>:@#@$$$ (a6989586621679682315 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ...
- data (:$$:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)))
- data (:$$:@#@$$) (a6989586621679682317 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))
- type family (a6989586621679682317 :: ErrorMessage' s) :$$:@#@$$$ (a6989586621679682318 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ...
- data TypeErrorSym0 :: (~>) PErrorMessage a
- type family TypeErrorSym1 (a6989586621679682320 :: PErrorMessage) :: a where ...
Documentation
type family TypeError (x :: PErrorMessage) :: a where ... Source #
Equations
| TypeError x = TypeError (ConvertPErrorMessage x) |
sTypeError :: HasCallStack => Sing err -> Sing (TypeError err) Source #
typeError :: HasCallStack => ErrorMessage -> a Source #
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.
|
| (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
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 #
Instances
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 |
type family ConvertPErrorMessage (a :: PErrorMessage) :: ErrorMessage where ... Source #
Convert a PErrorMessage to a ErrorMessage from GHC.TypeLits.
Equations
| ConvertPErrorMessage ('Text t) = 'Text t | |
| ConvertPErrorMessage ('ShowType ty) = 'ShowType ty | |
| ConvertPErrorMessage (e1 ':<>: e2) = ConvertPErrorMessage e1 ':<>: ConvertPErrorMessage e2 | |
| ConvertPErrorMessage (e1 ':$$: e2) = ConvertPErrorMessage e1 ':$$: ConvertPErrorMessage e2 |
showErrorMessage :: ErrorMessage -> String Source #
Convert an ErrorMessage into a human-readable String.
Defunctionalization symbols
data TextSym0 :: (~>) s (ErrorMessage' (s :: Type)) Source #
Instances
| SingI (TextSym0 :: TyFun Symbol (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError | |
| SuppressUnusedWarnings (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679682310 :: s) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply (TextSym0 :: TyFun s (ErrorMessage' s) -> Type) (a6989586621679682310 :: s) = 'Text a6989586621679682310 | |
type family TextSym1 (a6989586621679682310 :: s) :: ErrorMessage' (s :: Type) where ... Source #
data ShowTypeSym0 :: (~>) t (ErrorMessage' (s :: Type)) Source #
Instances
| SingI (ShowTypeSym0 :: TyFun t (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods sing :: Sing ShowTypeSym0 | |
| SuppressUnusedWarnings (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679682312 :: t) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply (ShowTypeSym0 :: TyFun t (ErrorMessage' s) -> Type) (a6989586621679682312 :: t) = 'ShowType a6989586621679682312 :: ErrorMessage' s | |
type family ShowTypeSym1 (a6989586621679682312 :: t) :: ErrorMessage' (s :: Type) where ... Source #
Equations
| ShowTypeSym1 a6989586621679682312 = 'ShowType a6989586621679682312 |
data (:<>:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))) infixl 6 Source #
Instances
| SingI ((:<>:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods sing :: Sing (:<>:@#@$) | |
| SuppressUnusedWarnings ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679682314 :: ErrorMessage' s) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply ((:<>:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679682314 :: ErrorMessage' s) = (:<>:@#@$$) a6989586621679682314 | |
data (:<>:@#@$$) (a6989586621679682314 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)) infixl 6 Source #
Instances
| SingI1 ((:<>:@#@$$) :: ErrorMessage' Symbol -> TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods liftSing :: forall (x :: k1). Sing x -> Sing ((:<>:@#@$$) x) | |
| SingI x => SingI ((:<>:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods sing :: Sing ((:<>:@#@$$) x) | |
| SuppressUnusedWarnings ((:<>:@#@$$) a6989586621679682314 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply ((:<>:@#@$$) a6989586621679682314 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679682315 :: ErrorMessage' s) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply ((:<>:@#@$$) a6989586621679682314 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679682315 :: ErrorMessage' s) = a6989586621679682314 ':<>: a6989586621679682315 | |
type family (a6989586621679682314 :: ErrorMessage' s) :<>:@#@$$$ (a6989586621679682315 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ... infixl 6 Source #
Equations
| a6989586621679682314 :<>:@#@$$$ a6989586621679682315 = '(:<>:) a6989586621679682314 a6989586621679682315 |
data (:$$:@#@$) :: (~>) (ErrorMessage' s) ((~>) (ErrorMessage' s) (ErrorMessage' (s :: Type))) infixl 5 Source #
Instances
| SingI ((:$$:@#@$) :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol ~> ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods sing :: Sing (:$$:@#@$) | |
| SuppressUnusedWarnings ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679682317 :: ErrorMessage' s) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply ((:$$:@#@$) :: TyFun (ErrorMessage' s) (ErrorMessage' s ~> ErrorMessage' s) -> Type) (a6989586621679682317 :: ErrorMessage' s) = (:$$:@#@$$) a6989586621679682317 | |
data (:$$:@#@$$) (a6989586621679682317 :: ErrorMessage' s) :: (~>) (ErrorMessage' s) (ErrorMessage' (s :: Type)) infixl 5 Source #
Instances
| SingI1 ((:$$:@#@$$) :: ErrorMessage' Symbol -> TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods liftSing :: forall (x :: k1). Sing x -> Sing ((:$$:@#@$$) x) | |
| SingI x => SingI ((:$$:@#@$$) x :: TyFun (ErrorMessage' Symbol) (ErrorMessage' Symbol) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods sing :: Sing ((:$$:@#@$$) x) | |
| SuppressUnusedWarnings ((:$$:@#@$$) a6989586621679682317 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply ((:$$:@#@$$) a6989586621679682317 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679682318 :: ErrorMessage' s) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply ((:$$:@#@$$) a6989586621679682317 :: TyFun (ErrorMessage' s) (ErrorMessage' s) -> Type) (a6989586621679682318 :: ErrorMessage' s) = a6989586621679682317 ':$$: a6989586621679682318 | |
type family (a6989586621679682317 :: ErrorMessage' s) :$$:@#@$$$ (a6989586621679682318 :: ErrorMessage' s) :: ErrorMessage' (s :: Type) where ... infixl 5 Source #
Equations
| a6989586621679682317 :$$:@#@$$$ a6989586621679682318 = '(:$$:) a6989586621679682317 a6989586621679682318 |
data TypeErrorSym0 :: (~>) PErrorMessage a Source #
Instances
| SingI (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods | |
| SuppressUnusedWarnings (TypeErrorSym0 :: TyFun PErrorMessage a -> Type) Source # | |
Defined in Data.Singletons.Base.TypeError Methods suppressUnusedWarnings :: () # | |
| type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679682320 :: PErrorMessage) Source # | |
Defined in Data.Singletons.Base.TypeError type Apply (TypeErrorSym0 :: TyFun PErrorMessage k2 -> Type) (a6989586621679682320 :: PErrorMessage) = TypeError a6989586621679682320 :: k2 | |
type family TypeErrorSym1 (a6989586621679682320 :: PErrorMessage) :: a where ... Source #
Equations
| TypeErrorSym1 a6989586621679682320 = TypeError a6989586621679682320 |