purescript-0.15.12: PureScript Programming Language Compiler
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.PureScript.Errors

Synopsis

Documentation

data ErrorMessage #

Instances

Instances details
Show ErrorMessage # 
Instance details

Defined in Language.PureScript.Errors

Methods

showsPrec :: Int -> ErrorMessage -> ShowS #

show :: ErrorMessage -> String #

showList :: [ErrorMessage] -> ShowS #

data Level #

How critical the issue is

Constructors

Error 
Warning 

Instances

Instances details
Show Level # 
Instance details

Defined in Language.PureScript.Errors

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

data TypeMap #

A map from rigid type variable name/unknown variable pairs to new variables.

Constructors

TypeMap 

Fields

  • umSkolemMap :: Map Int (String, Int, Maybe SourceSpan)

    a map from skolems to their new names, including source and naming info

  • umUnknownMap :: Map Int Int

    a map from unification variables to their new names

  • umNextIndex :: Int

    unknowns and skolems share a source of names during renaming, to avoid overlaps in error messages. This is the next label for either case.

Instances

Instances details
Show TypeMap # 
Instance details

Defined in Language.PureScript.Errors

Methods

showsPrec :: Int -> TypeMap -> ShowS #

show :: TypeMap -> String #

showList :: [TypeMap] -> ShowS #

data SimpleErrorMessage #

A type of error messages

Constructors

InternalCompilerError Text Text 
ModuleNotFound ModuleName 
ErrorParsingFFIModule FilePath (Maybe ErrorMessage) 
ErrorParsingCSTModule ParserError 
WarningParsingCSTModule ParserWarning 
MissingFFIModule ModuleName 
UnnecessaryFFIModule ModuleName FilePath 
MissingFFIImplementations ModuleName [Ident] 
UnusedFFIImplementations ModuleName [Ident] 
InvalidFFIIdentifier ModuleName Text 
DeprecatedFFIPrime ModuleName Text 
DeprecatedFFICommonJSModule ModuleName FilePath 
UnsupportedFFICommonJSExports ModuleName [Text] 
UnsupportedFFICommonJSImports ModuleName [Text] 
FileIOError Text IOError

A description of what we were trying to do, and the error which occurred

InfiniteType SourceType 
InfiniteKind SourceType 
MultipleValueOpFixities (OpName 'ValueOpName) 
MultipleTypeOpFixities (OpName 'TypeOpName) 
OrphanTypeDeclaration Ident 
OrphanKindDeclaration (ProperName 'TypeName) 
OrphanRoleDeclaration (ProperName 'TypeName) 
RedefinedIdent Ident 
OverlappingNamesInLet Ident 
UnknownName (Qualified Name) 
UnknownImport ModuleName Name 
UnknownImportDataConstructor ModuleName (ProperName 'TypeName) (ProperName 'ConstructorName) 
UnknownExport Name 
UnknownExportDataConstructor (ProperName 'TypeName) (ProperName 'ConstructorName) 
ScopeConflict Name [ModuleName] 
ScopeShadowing Name (Maybe ModuleName) [ModuleName] 
DeclConflict Name Name 
ExportConflict (Qualified Name) (Qualified Name) 
DuplicateModule ModuleName 
DuplicateTypeClass (ProperName 'ClassName) SourceSpan 
DuplicateInstance Ident SourceSpan 
DuplicateTypeArgument Text 
InvalidDoBind 
InvalidDoLet 
CycleInDeclaration Ident 
CycleInTypeSynonym (NonEmpty (ProperName 'TypeName)) 
CycleInTypeClassDeclaration (NonEmpty (Qualified (ProperName 'ClassName))) 
CycleInKindDeclaration (NonEmpty (Qualified (ProperName 'TypeName))) 
CycleInModules (NonEmpty ModuleName) 
NameIsUndefined Ident 
UndefinedTypeVariable (ProperName 'TypeName) 
PartiallyAppliedSynonym (Qualified (ProperName 'TypeName)) 
EscapedSkolem Text (Maybe SourceSpan) SourceType 
TypesDoNotUnify SourceType SourceType 
KindsDoNotUnify SourceType SourceType 
ConstrainedTypeUnified SourceType SourceType 
OverlappingInstances (Qualified (ProperName 'ClassName)) [SourceType] [Qualified (Either SourceType Ident)] 
NoInstanceFound 

Fields

AmbiguousTypeVariables SourceType [(Text, Int)] 
UnknownClass (Qualified (ProperName 'ClassName)) 
PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [SourceType] 
PossiblyInfiniteCoercibleInstance 
CannotDerive (Qualified (ProperName 'ClassName)) [SourceType] 
InvalidDerivedInstance (Qualified (ProperName 'ClassName)) [SourceType] Int 
ExpectedTypeConstructor (Qualified (ProperName 'ClassName)) [SourceType] SourceType 
InvalidNewtypeInstance (Qualified (ProperName 'ClassName)) [SourceType] 
MissingNewtypeSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType] 
UnverifiableSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType] 
CannotFindDerivingType (ProperName 'TypeName) 
DuplicateLabel Label (Maybe Expr) 
DuplicateValueDeclaration Ident 
ArgListLengthsDiffer Ident 
OverlappingArgNames (Maybe Ident) 
MissingClassMember (NonEmpty (Ident, SourceType)) 
ExtraneousClassMember Ident (Qualified (ProperName 'ClassName)) 
ExpectedType SourceType SourceType 
IncorrectConstructorArity (Qualified (ProperName 'ConstructorName)) Int Int

constructor name, expected argument count, actual argument count

ExprDoesNotHaveType Expr SourceType 
PropertyIsMissing Label 
AdditionalProperty Label 
OrphanInstance Ident (Qualified (ProperName 'ClassName)) (Set ModuleName) [SourceType] 
InvalidNewtype (ProperName 'TypeName) 
InvalidInstanceHead SourceType 
TransitiveExportError DeclarationRef [DeclarationRef] 
TransitiveDctorExportError DeclarationRef [ProperName 'ConstructorName] 
HiddenConstructors DeclarationRef (Qualified (ProperName 'ClassName)) 
ShadowedName Ident 
ShadowedTypeVar Text 
UnusedTypeVar Text 
UnusedName Ident 
UnusedDeclaration Ident 
WildcardInferredType SourceType Context 
HoleInferredType Text SourceType Context (Maybe TypeSearch) 
MissingTypeDeclaration Ident SourceType 
MissingKindDeclaration KindSignatureFor (ProperName 'TypeName) SourceType 
OverlappingPattern [[Binder]] Bool 
IncompleteExhaustivityCheck 
ImportHidingModule ModuleName 
UnusedImport ModuleName (Maybe ModuleName) 
UnusedExplicitImport ModuleName [Name] (Maybe ModuleName) [DeclarationRef] 
UnusedDctorImport ModuleName (ProperName 'TypeName) (Maybe ModuleName) [DeclarationRef] 
UnusedDctorExplicitImport ModuleName (ProperName 'TypeName) [ProperName 'ConstructorName] (Maybe ModuleName) [DeclarationRef] 
DuplicateSelectiveImport ModuleName 
DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName) 
DuplicateImportRef Name 
DuplicateExportRef Name 
IntOutOfRange Integer Text Integer Integer 
ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef] 
ImplicitQualifiedImportReExport ModuleName ModuleName [DeclarationRef] 
ImplicitImport ModuleName [DeclarationRef] 
HidingImport ModuleName [DeclarationRef] 
CaseBinderLengthDiffers Int [Binder] 
IncorrectAnonymousArgument 
InvalidOperatorInBinder (Qualified (OpName 'ValueOpName)) (Qualified Ident) 
CannotGeneralizeRecursiveFunction Ident SourceType 
CannotDeriveNewtypeForData (ProperName 'TypeName) 
ExpectedWildcard (ProperName 'TypeName) 
CannotUseBindWithDo Ident 
ClassInstanceArityMismatch Ident (Qualified (ProperName 'ClassName)) Int Int

instance name, type class, expected argument count, actual argument count

UserDefinedWarning SourceType

a user-defined warning raised by using the Warn type class

UnusableDeclaration Ident [[Text]]

a declaration couldn't be used because it contained free variables

CannotDefinePrimModules ModuleName 
MixedAssociativityError (NonEmpty (Qualified (OpName 'AnyOpName), Associativity)) 
NonAssociativeError (NonEmpty (Qualified (OpName 'AnyOpName))) 
QuantificationCheckFailureInKind Text 
QuantificationCheckFailureInType [Int] SourceType 
VisibleQuantificationCheckFailureInType Text 
UnsupportedTypeInKind SourceType 
RoleMismatch

Declared role was more permissive than inferred.

Fields

  • Text

    Type variable in question

  • Role

    inferred role

  • Role

    declared role

InvalidCoercibleInstanceDeclaration [SourceType] 
UnsupportedRoleDeclaration 
RoleDeclarationArityMismatch (ProperName 'TypeName) Int Int 
DuplicateRoleDeclaration (ProperName 'TypeName) 
CannotDeriveInvalidConstructorArg (Qualified (ProperName 'ClassName)) [Qualified (ProperName 'ClassName)] Bool 
CannotSkipTypeApplication SourceType 
CannotApplyExpressionOfTypeOnType SourceType SourceType 

Instances

Instances details
Show SimpleErrorMessage # 
Instance details

Defined in Language.PureScript.Errors

Methods

showsPrec :: Int -> SimpleErrorMessage -> ShowS #

show :: SimpleErrorMessage -> String #

showList :: [SimpleErrorMessage] -> ShowS #

newtype ErrorSuggestion #

Constructors

ErrorSuggestion Text 

data PPEOptions #

Constructors

PPEOptions 

Fields

renderBox :: Box -> String #

line :: Text -> Box #

errorMessage :: SimpleErrorMessage -> MultipleErrors #

Create an error set from a single simple error message

nonEmpty :: MultipleErrors -> Bool #

Check whether a collection of errors is empty or not.

indent :: Box -> Box #

Indent to the right, and pad on top and bottom.

rethrow :: MonadError e m => (e -> e) -> m a -> m a #

Rethrow an error with a more detailed error message in the case of failure

errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors #

Create an error set from a single simple error message and source annotation

rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a #

Rethrow an error with source position information

addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors #

Add a hint to an error message

defaultPPEOptions :: PPEOptions #

Default options for PPEOptions

errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors #

Create an error set from a single simple error message and source annotations

prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String #

Pretty print multiple errors

singleError :: ErrorMessage -> MultipleErrors #

Create an error set from a single error message

parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] #

Collect errors in in parallel

warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a #

warnWithPosition :: MonadWriter MultipleErrors m => SourceSpan -> m a -> m a #

addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors #

Add hints to an error message

escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a #

Runs a computation listening for warnings and then escalating any warnings that match the predicate to error status.

onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors #

Lift a function on ErrorMessage to a function on MultipleErrors

errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan) #

Get the source span for an error

errorModule :: ErrorMessage -> Maybe ModuleName #

Get the module name for an error

stripModuleAndSpan :: ErrorMessage -> ErrorMessage #

Remove the module name and span hints from an error

errorCode :: ErrorMessage -> Text #

Get the error code for a particular error type

unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage #

Extract nested error messages from wrapper errors

errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors #

Create an error from multiple (possibly empty) source spans, reversed sorted.

ansiColorReset :: String #

defaultCodeColor :: (ColorIntensity, Color) #

Default color intensity and color for code

prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box #

Pretty print a single error, simplifying if necessary

lineS :: String -> Box #

prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] #

Pretty print errors as a Box

prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String #

Pretty print multiple warnings

prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] #

Pretty print warnings as a Box