futhark-0.25.27: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Error

Description

Futhark error definitions.

Synopsis

- data CompilerError
  - = ExternalError (Doc AnsiStyle)
  - | InternalError Text Text ErrorClass
- prettyCompilerError :: CompilerError -> Doc AnsiStyle
- data ErrorClass
  - = CompilerBug
  - | CompilerLimitation
- externalError :: MonadError CompilerError m => Doc AnsiStyle -> m a
- externalErrorS :: MonadError CompilerError m => String -> m a
- data InternalError = Error ErrorClass Text
- compilerBug :: Text -> a
- compilerBugS :: String -> a
- compilerLimitation :: Text -> a
- compilerLimitationS :: String -> a
- internalErrorS :: MonadError CompilerError m => String -> Doc AnsiStyle -> m a

# Documentation

data CompilerError Source #

A compiler error.

Constructors

ExternalError (Doc AnsiStyle) | An error that happened due to something the user did, such as provide incorrect code or options.
InternalError Text Text ErrorClass | An internal compiler error. The second pretty is extra data for debugging, which can be written to a file.

#### Instances

Instances details

MonadError CompilerError FutharkM Source # |
Instance details Defined in Futhark.Pipeline Methods throwError :: CompilerError -> FutharkM a Source # catchError :: FutharkM a -> (CompilerError -> FutharkM a) -> FutharkM a Source #

prettyCompilerError :: CompilerError -> Doc AnsiStyle Source #

Print an error intended for human consumption.

data ErrorClass Source #

There are two classes of internal errors: actual bugs, and implementation limitations. The latter are already known and need not be reported.

Constructors

CompilerBug |
CompilerLimitation |

#### Instances

Instances details

Show ErrorClass Source # |
Instance details Defined in Futhark.Error Methods showsPrec :: Int -> ErrorClass -> ShowS Source # show :: ErrorClass -> String Source # showList :: [ErrorClass] -> ShowS Source #
Eq ErrorClass Source # |
Instance details Defined in Futhark.Error Methods (==) :: ErrorClass -> ErrorClass -> Bool Source # (/=) :: ErrorClass -> ErrorClass -> Bool Source #
Ord ErrorClass Source # |

Instance details

Defined in Futhark.Error

Methods

compare :: ErrorClass -> ErrorClass -> Ordering Source #

(<) :: ErrorClass -> ErrorClass -> Bool Source #

(<=) :: ErrorClass -> ErrorClass -> Bool Source #

(>) :: ErrorClass -> ErrorClass -> Bool Source #

(>=) :: ErrorClass -> ErrorClass -> Bool Source #

max :: ErrorClass -> ErrorClass -> ErrorClass Source #

min :: ErrorClass -> ErrorClass -> ErrorClass Source #

externalError :: MonadError CompilerError m => Doc AnsiStyle -> m a Source #

Raise an `ExternalError` based on a prettyprinting result.

externalErrorS :: MonadError CompilerError m => String -> m a Source #

Raise an `ExternalError` based on a string.

data InternalError Source #

An error that is not the users fault, but a bug (or limitation) in the compiler. Compiler passes should only ever report this error - any problems after the type checker are *our* fault, not the users. These are generally thrown as IO exceptions, and caught at the top level.

Constructors

Error ErrorClass Text |

#### Instances

Instances details

Exception InternalError Source # |
Instance details Defined in Futhark.Error Methods toException :: InternalError -> SomeException Source # fromException :: SomeException -> Maybe InternalError Source # displayException :: InternalError -> String Source #
Show InternalError Source # |
Instance details Defined in Futhark.Error Methods showsPrec :: Int -> InternalError -> ShowS Source # show :: InternalError -> String Source # showList :: [InternalError] -> ShowS Source #

compilerBug :: Text -> a Source #

Throw an `InternalError` that is a `CompilerBug`.

compilerBugS :: String -> a Source #

Like `compilerBug`, but with a `String`.

compilerLimitation :: Text -> a Source #

Throw an `InternalError` that is a `CompilerLimitation`.

compilerLimitationS :: String -> a Source #

Like `compilerLimitation`, but with a `String`.

internalErrorS :: MonadError CompilerError m => String -> Doc AnsiStyle -> m a Source #

Raise an `InternalError` based on a prettyprinting result.