Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.TypeSpec.Internal.Result
Description
A result type used in constraints inside TypeSpec
to chain computations
that may fail with a TypeError
.
Synopsis
Results that with TypeErrors
type Result = Either ErrorMessage Source #
When a type level expectation is tested, it might be that compound
expectations fail. In order to have a small, precise error message, the type
level assertion results are made to have kind Result
.
type family Try (e :: Result k) :: k where ... Source #
Return the result or fail with a TypeError
Equations
Try (OK d :: Either ErrorMessage k) = d | |
Try (FAILED m :: Either ErrorMessage k) = TypeError m :: k |
Extending Error Messages
type family PrependToError (message :: ErrorMessage) (result :: Result a) :: Result a where ... Source #
In case of
prepend a message to the message, if the
parameter was Left
ErrorMessage
just return Right
x
.Right
x
Equations
PrependToError message (OK x :: Either ErrorMessage b) = OK x | |
PrependToError message (FAILED otherMessage :: Either ErrorMessage a) = FAILED (message ':<>: otherMessage) |