Safe Haskell | None |
---|---|
Language | Haskell2010 |
An interface for reporting "impossible" errors
Synopsis
- data Impossible
- throwImpossible :: Impossible -> a
- class CatchImpossible m where
- catchImpossible :: m a -> (Impossible -> m a) -> m a
- catchImpossibleJust :: (Impossible -> Maybe b) -> m a -> (b -> m a) -> m a
- handleImpossible :: (Impossible -> m a) -> m a -> m a
- handleImpossibleJust :: (Impossible -> Maybe b) -> (b -> m a) -> m a -> m a
- withFileAndLine' :: Integral a => CallStack -> (String -> a -> b) -> b
- withFileAndLine :: (HasCallStack, Integral a) => (String -> a -> b) -> b
- __IMPOSSIBLE__ :: HasCallStack => a
- __UNREACHABLE__ :: HasCallStack => a
Documentation
data Impossible Source #
"Impossible" errors, annotated with a file name and a line number corresponding to the source code location of the error.
Impossible String Integer | We reached a program point which should be unreachable. |
Unreachable String Integer |
|
ImpMissingDefinitions [String] String | We reached a program point without all the required
primitives or BUILTIN to proceed forward.
|
Instances
Show Impossible Source # | |
Defined in Agda.Utils.Impossible showsPrec :: Int -> Impossible -> ShowS # show :: Impossible -> String # showList :: [Impossible] -> ShowS # | |
Exception Impossible Source # | |
Defined in Agda.Utils.Impossible toException :: Impossible -> SomeException # fromException :: SomeException -> Maybe Impossible # displayException :: Impossible -> String # | |
EmbPrj Impossible Source # | |
Defined in Agda.TypeChecking.Serialise.Instances.Common |
throwImpossible :: Impossible -> a Source #
Abort by throwing an "impossible" error. You should not use this function directly. Instead use IMPOSSIBLE
class CatchImpossible m where Source #
Monads in which we can catch an "impossible" error, if possible.
catchImpossible :: m a -> (Impossible -> m a) -> m a Source #
Catch any Impossible
exception.
catchImpossibleJust :: (Impossible -> Maybe b) -> m a -> (b -> m a) -> m a Source #
Catch only Impossible
exceptions selected by the filter.
handleImpossible :: (Impossible -> m a) -> m a -> m a Source #
Version of catchImpossible
with argument order suiting short handlers.
handleImpossibleJust :: (Impossible -> Maybe b) -> (b -> m a) -> m a -> m a Source #
Version of catchImpossibleJust
with argument order suiting short handlers.
Instances
CatchImpossible IO Source # | |
Defined in Agda.Utils.Impossible catchImpossible :: IO a -> (Impossible -> IO a) -> IO a Source # catchImpossibleJust :: (Impossible -> Maybe b) -> IO a -> (b -> IO a) -> IO a Source # handleImpossible :: (Impossible -> IO a) -> IO a -> IO a Source # handleImpossibleJust :: (Impossible -> Maybe b) -> (b -> IO a) -> IO a -> IO a Source # | |
CatchImpossible TCM Source # | Like The intended use is to catch internal errors during debug printing. In debug printing, we are not expecting state changes. |
Defined in Agda.TypeChecking.Monad.Base catchImpossible :: TCM a -> (Impossible -> TCM a) -> TCM a Source # catchImpossibleJust :: (Impossible -> Maybe b) -> TCM a -> (b -> TCM a) -> TCM a Source # handleImpossible :: (Impossible -> TCM a) -> TCM a -> TCM a Source # handleImpossibleJust :: (Impossible -> Maybe b) -> (b -> TCM a) -> TCM a -> TCM a Source # |
withFileAndLine' :: Integral a => CallStack -> (String -> a -> b) -> b Source #
Create something with a callstack's file and line number
withFileAndLine :: (HasCallStack, Integral a) => (String -> a -> b) -> b Source #
Create something with the call site's file and line number
__IMPOSSIBLE__ :: HasCallStack => a Source #
Throw an Impossible error reporting the *caller's* call site.
__UNREACHABLE__ :: HasCallStack => a Source #
Throw an Unreachable error reporting the *caller's* call site. Note that this call to "withFileAndLine" will be filtered out due its filter on the srcLocModule.