Safe Haskell | None |
---|---|
Language | Haskell2010 |
- module Language.PureScript.AST
- newtype ErrorSuggestion = ErrorSuggestion Text
- errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan)
- errorModule :: ErrorMessage -> Maybe ModuleName
- findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a
- stripModuleAndSpan :: ErrorMessage -> ErrorMessage
- errorCode :: ErrorMessage -> Text
- newtype MultipleErrors = MultipleErrors {}
- nonEmpty :: MultipleErrors -> Bool
- errorMessage :: SimpleErrorMessage -> MultipleErrors
- errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors
- errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors
- singleError :: ErrorMessage -> MultipleErrors
- onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors
- addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors
- addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors
- data TypeMap = TypeMap {
- umSkolemMap :: Map Int (String, Int, Maybe SourceSpan)
- umUnknownMap :: Map Int Int
- umNextIndex :: Int
- defaultUnknownMap :: TypeMap
- data Level
- unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage
- replaceUnknowns :: Type -> State TypeMap Type
- onTypesInErrorMessage :: (Type -> Type) -> ErrorMessage -> ErrorMessage
- onTypesInErrorMessageM :: Applicative m => (Type -> m Type) -> ErrorMessage -> m ErrorMessage
- errorDocUri :: ErrorMessage -> Text
- errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion
- suggestionSpan :: ErrorMessage -> Maybe SourceSpan
- showSuggestion :: SimpleErrorMessage -> Text
- ansiColor :: (ColorIntensity, Color) -> String
- ansiColorReset :: String
- colorCode :: Maybe (ColorIntensity, Color) -> Text -> Text
- colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box
- defaultCodeColor :: (ColorIntensity, Color)
- data PPEOptions = PPEOptions {}
- defaultPPEOptions :: PPEOptions
- prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box
- prettyPrintExport :: DeclarationRef -> Text
- prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text
- prettyPrintRef :: DeclarationRef -> Maybe Text
- prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String
- prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String
- prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box]
- prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box]
- prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box]
- prettyPrintParseError :: ParseError -> Box
- prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box
- indent :: Box -> Box
- line :: Text -> Box
- lineS :: String -> Box
- renderBox :: Box -> String
- toTypelevelString :: Type -> Maybe Box
- rethrow :: MonadError e m => (e -> e) -> m a -> m a
- reifyErrors :: MonadError e m => m a -> m (Either e a)
- reflectErrors :: MonadError e m => m (Either e a) -> m a
- warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a
- rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a
- warnWithPosition :: MonadWriter MultipleErrors m => SourceSpan -> m a -> m a
- warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a
- withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage
- positionedError :: SourceSpan -> ErrorMessageHint
- escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a
- parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b]
Documentation
module Language.PureScript.AST
newtype ErrorSuggestion Source #
errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan) Source #
Get the source span for an error
errorModule :: ErrorMessage -> Maybe ModuleName Source #
Get the module name for an error
findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a Source #
stripModuleAndSpan :: ErrorMessage -> ErrorMessage Source #
Remove the module name and span hints from an error
errorCode :: ErrorMessage -> Text Source #
Get the error code for a particular error type
newtype MultipleErrors Source #
A stack trace for an error
nonEmpty :: MultipleErrors -> Bool Source #
Check whether a collection of errors is empty or not.
errorMessage :: SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message
errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message and source annotation
errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message and source annotations
singleError :: ErrorMessage -> MultipleErrors Source #
Create an error set from a single error message
onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors Source #
Lift a function on ErrorMessage to a function on MultipleErrors
addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors Source #
Add a hint to an error message
addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors Source #
Add hints to an error message
A map from rigid type variable name/unknown variable pairs to new variables.
TypeMap | |
|
unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage Source #
Extract nested error messages from wrapper errors
onTypesInErrorMessage :: (Type -> Type) -> ErrorMessage -> ErrorMessage Source #
onTypesInErrorMessageM :: Applicative m => (Type -> m Type) -> ErrorMessage -> m ErrorMessage Source #
errorDocUri :: ErrorMessage -> Text Source #
colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box Source #
defaultCodeColor :: (ColorIntensity, Color) Source #
Default color intesity and color for code
data PPEOptions Source #
prettyPrintSingleError
Options
PPEOptions | |
|
defaultPPEOptions :: PPEOptions Source #
Default options for PPEOptions
prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box Source #
Pretty print a single error, simplifying if necessary
prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text Source #
prettyPrintRef :: DeclarationRef -> Maybe Text Source #
prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String Source #
Pretty print multiple errors
prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String Source #
Pretty print multiple warnings
prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] Source #
Pretty print warnings as a Box
prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] Source #
Pretty print errors as a Box
prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box] Source #
prettyPrintParseError :: ParseError -> Box Source #
Pretty print a Parsec ParseError as a Box
prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box Source #
Pretty print ParseError
detail messages.
Adapted from showErrorMessages
.
See https://github.com/aslatter/parsec/blob/v3.1.9/Text/Parsec/Error.hs#L173.
rethrow :: MonadError e m => (e -> e) -> m a -> m a Source #
Rethrow an error with a more detailed error message in the case of failure
reifyErrors :: MonadError e m => m a -> m (Either e a) Source #
reflectErrors :: MonadError e m => m (Either e a) -> m a Source #
warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a Source #
rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a Source #
Rethrow an error with source position information
warnWithPosition :: MonadWriter MultipleErrors m => SourceSpan -> m a -> m a Source #
warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a Source #
withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage Source #
escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a Source #
Runs a computation listening for warnings and then escalating any warnings that match the predicate to error status.
parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] Source #
Collect errors in in parallel