@@ -51,7 +51,11 @@ import qualified Text.Parsec as P
52data SimpleErrorMessage
52data SimpleErrorMessage
53 = ErrorParsingExterns P.ParseError
53 = ErrorParsingExterns P.ParseError
54− | ErrorParsingPrelude P.ParseError
54+ | ErrorParsingFFIModule FilePath
55+ | ErrorParsingModule P.ParseError
56+ | MissingFFIModule ModuleName
57+ | MultipleFFIModules ModuleName [FilePath]
58+ | UnnecessaryFFIModule ModuleName FilePath
55 | InvalidExternsFile FilePath
59 | InvalidExternsFile FilePath
56 | CannotGetFileInfo FilePath
60 | CannotGetFileInfo FilePath
57 | CannotReadFile FilePath
61 | CannotReadFile FilePath
@@ -115,13 +119,13 @@ data SimpleErrorMessage
115 | TransitiveExportError DeclarationRef [DeclarationRef]
119 | TransitiveExportError DeclarationRef [DeclarationRef]
116 | ShadowedName Ident
120 | ShadowedName Ident
117 | WildcardInferredType Type
121 | WildcardInferredType Type
118− | PreludeNotPresent
122+ | ClassOperator ProperName Ident
119 deriving (Show)
123 deriving (Show)
122-- Wrapper of simpler errors
126-- Wrapper of simpler errors
124−data ErrorMessage
128+data ErrorMessage
125 = NotYetDefined [Ident] ErrorMessage
129 = NotYetDefined [Ident] ErrorMessage
126 | ErrorUnifyingTypes Type Type ErrorMessage
130 | ErrorUnifyingTypes Type Type ErrorMessage
127 | ErrorInExpression Expr ErrorMessage
131 | ErrorInExpression Expr ErrorMessage
@@ -142,10 +146,10 @@ data ErrorMessage
142 | PositionedError SourceSpan ErrorMessage
146 | PositionedError SourceSpan ErrorMessage
143 | SimpleErrorWrapper SimpleErrorMessage
147 | SimpleErrorWrapper SimpleErrorMessage
144 deriving (Show)
148 deriving (Show)
146instance UnificationError Type ErrorMessage where
150instance UnificationError Type ErrorMessage where
147 occursCheckFailed t = SimpleErrorWrapper $ InfiniteType t
151 occursCheckFailed t = SimpleErrorWrapper $ InfiniteType t
149instance UnificationError Kind ErrorMessage where
153instance UnificationError Kind ErrorMessage where
150 occursCheckFailed k = SimpleErrorWrapper $ InfiniteKind k
154 occursCheckFailed k = SimpleErrorWrapper $ InfiniteKind k
@@ -155,7 +159,11 @@ instance UnificationError Kind ErrorMessage where
155errorCode :: ErrorMessage -> String
159errorCode :: ErrorMessage -> String
156errorCode em = case unwrapErrorMessage em of
160errorCode em = case unwrapErrorMessage em of
157 (ErrorParsingExterns _) -> "ErrorParsingExterns"
161 (ErrorParsingExterns _) -> "ErrorParsingExterns"
158− (ErrorParsingPrelude _) -> "ErrorParsingPrelude"
162+ (ErrorParsingFFIModule _) -> "ErrorParsingFFIModule"
163+ (ErrorParsingModule _) -> "ErrorParsingModule"
164+ MissingFFIModule{} -> "MissingFFIModule"
165+ MultipleFFIModules{} -> "MultipleFFIModules"
166+ UnnecessaryFFIModule{} -> "UnnecessaryFFIModule"
159 (InvalidExternsFile _) -> "InvalidExternsFile"
167 (InvalidExternsFile _) -> "InvalidExternsFile"
160 (CannotGetFileInfo _) -> "CannotGetFileInfo"
168 (CannotGetFileInfo _) -> "CannotGetFileInfo"
161 (CannotReadFile _) -> "CannotReadFile"
169 (CannotReadFile _) -> "CannotReadFile"
@@ -219,17 +227,17 @@ errorCode em = case unwrapErrorMessage em of
219 (TransitiveExportError _ _) -> "TransitiveExportError"
227 (TransitiveExportError _ _) -> "TransitiveExportError"
220 (ShadowedName _) -> "ShadowedName"
228 (ShadowedName _) -> "ShadowedName"
221 (WildcardInferredType _) -> "WildcardInferredType"
229 (WildcardInferredType _) -> "WildcardInferredType"
222− PreludeNotPresent -> "PreludeNotPresent"
230+ (ClassOperator _ _) -> "ClassOperator"
225-- A stack trace for an error
233-- A stack trace for an error
227−newtype MultipleErrors = MultipleErrors
235+newtype MultipleErrors = MultipleErrors
228 { runMultipleErrors :: [ErrorMessage] } deriving (Show, Monoid)
236 { runMultipleErrors :: [ErrorMessage] } deriving (Show, Monoid)
230instance UnificationError Type MultipleErrors where
238instance UnificationError Type MultipleErrors where
231 occursCheckFailed = occursCheckFailed
239 occursCheckFailed = occursCheckFailed
233instance UnificationError Kind MultipleErrors where
241instance UnificationError Kind MultipleErrors where
234 occursCheckFailed = occursCheckFailed
242 occursCheckFailed = occursCheckFailed
@@ -288,7 +296,7 @@ unwrapErrorMessage em = case em of
288 (SimpleErrorWrapper sem) -> sem
296 (SimpleErrorWrapper sem) -> sem
290replaceUnknowns :: Type -> State UnknownMap Type
298replaceUnknowns :: Type -> State UnknownMap Type
291−replaceUnknowns = everywhereOnTypesM replaceTypes
299+replaceUnknowns = everywhereOnTypesM replaceTypes
293 lookupTable :: (LabelType, Unknown) -> UnknownMap -> (Unknown, UnknownMap)
301 lookupTable :: (LabelType, Unknown) -> UnknownMap -> (Unknown, UnknownMap)
294 lookupTable x m = case M.lookup x m of
302 lookupTable x m = case M.lookup x m of
@@ -348,195 +356,292 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
349 wikiUri :: String
357 wikiUri :: String
350 wikiUri = "https://github.com/purescript/purescript/wiki/Error-Code-" ++ errorCode e
358 wikiUri = "https://github.com/purescript/purescript/wiki/Error-Code-" ++ errorCode e
352 go :: ErrorMessage -> Box.Box
360 go :: ErrorMessage -> Box.Box
353− goSimple (CannotGetFileInfo path) = paras [ line "Unable to read file info: "
361+ goSimple (CannotGetFileInfo path) =
362+ paras [ line "Unable to read file info: "
354− , indent . line $ path
363+ , indent . line $ path
356− goSimple (CannotReadFile path) = paras [ line "Unable to read file: "
365+ goSimple (CannotReadFile path) =
366+ paras [ line "Unable to read file: "
357− , indent . line $ path
367+ , indent . line $ path
359− goSimple (CannotWriteFile path) = paras [ line "Unable to write file: "
369+ goSimple (CannotWriteFile path) =
370+ paras [ line "Unable to write file: "
360− , indent . line $ path
371+ , indent . line $ path
373+ goSimple (ErrorParsingExterns err) =
362− goSimple (ErrorParsingExterns err) = paras [ line "Error parsing externs files: "
374+ paras [ line "Error parsing externs files: "
363− , indent . line . show $ err
375+ , indent . line . show $ err
377+ goSimple (ErrorParsingFFIModule path) =
378+ paras [ line "Unable to parse module from FFI file: "
379+ , indent . line $ path
365− goSimple (ErrorParsingPrelude err) = paras [ line "Error parsing prelude: "
381+ goSimple (ErrorParsingModule err) =
382+ paras [ line "Unable to parse module: "
366− , indent . line . show $ err
383+ , indent . line . show $ err
385+ goSimple (MissingFFIModule mn) =
386+ line $ "Missing FFI implementations for module " ++ show mn
387+ goSimple (UnnecessaryFFIModule mn path) =
388+ paras [ line $ "Unnecessary FFI implementations have been provided for module " ++ show mn ++ ": "
389+ , indent . line $ path
391+ goSimple (MultipleFFIModules mn paths) =
392+ paras $ [ line $ "Multiple FFI implementations have been provided for module " ++ show mn ++ ": " ]
393+ ++ map (indent . line) paths
394+ goSimple (InvalidExternsFile path) =
368− goSimple (InvalidExternsFile path) = paras [ line "Externs file is invalid: "
395+ paras [ line "Externs file is invalid: "
369− , indent . line $ path
396+ , indent . line $ path
398+ goSimple InvalidDoBind =
371− goSimple InvalidDoBind = line "Bind statement cannot be the last statement in a do block"
399+ line "Bind statement cannot be the last statement in a do block"
400+ goSimple InvalidDoLet =
372− goSimple InvalidDoLet = line "Let statement cannot be the last statement in a do block"
401+ line "Let statement cannot be the last statement in a do block"
373− goSimple CannotReorderOperators = line "Unable to reorder operators"
402+ goSimple CannotReorderOperators =
403+ line "Unable to reorder operators"
404+ goSimple UnspecifiedSkolemScope =
374− goSimple UnspecifiedSkolemScope = line "Skolem variable scope is unspecified"
405+ line "Skolem variable scope is unspecified"
406+ goSimple OverlappingNamesInLet =
375− goSimple OverlappingNamesInLet = line "Overlapping names in let binding."
407+ line "Overlapping names in let binding."
408+ goSimple (InfiniteType ty) =
376− goSimple (InfiniteType ty) = paras [ line "Infinite type detected: "
409+ paras [ line "Infinite type detected: "
377− , indent $ line $ prettyPrintType ty
410+ , indent $ line $ prettyPrintType ty
412+ goSimple (InfiniteKind ki) =
379− goSimple (InfiniteKind ki) = paras [ line "Infinite kind detected: "
413+ paras [ line "Infinite kind detected: "
380− , indent $ line $ prettyPrintKind ki
414+ , indent $ line $ prettyPrintKind ki
416+ goSimple (MultipleFixities name) =
382− goSimple (MultipleFixities name) = line $ "Multiple fixity declarations for " ++ show name
417+ line $ "Multiple fixity declarations for " ++ show name
418+ goSimple (OrphanTypeDeclaration nm) =
383− goSimple (OrphanTypeDeclaration nm) = line $ "Orphan type declaration for " ++ show nm
419+ line $ "Orphan type declaration for " ++ show nm
420+ goSimple (OrphanFixityDeclaration op) =
384− goSimple (OrphanFixityDeclaration op) = line $ "Orphan fixity declaration for " ++ show op
421+ line $ "Orphan fixity declaration for " ++ show op
422+ goSimple (RedefinedModule name) =
385− goSimple (RedefinedModule name) = line $ "Module " ++ show name ++ " has been defined multiple times"
423+ line $ "Module " ++ show name ++ " has been defined multiple times"
424+ goSimple (RedefinedIdent name) =
386− goSimple (RedefinedIdent name) = line $ "Name " ++ show name ++ " has been defined multiple times"
425+ line $ "Name " ++ show name ++ " has been defined multiple times"
387− goSimple (UnknownModule mn) = line $ "Unknown module " ++ show mn
426+ goSimple (UnknownModule mn) =
427+ line $ "Unknown module " ++ show mn
388− goSimple (UnknownType name) = line $ "Unknown type " ++ show name
428+ goSimple (UnknownType name) =
429+ line $ "Unknown type " ++ show name
389− goSimple (UnknownTypeClass name) = line $ "Unknown type class " ++ show name
430+ goSimple (UnknownTypeClass name) =
431+ line $ "Unknown type class " ++ show name
390− goSimple (UnknownValue name) = line $ "Unknown value " ++ show name
432+ goSimple (UnknownValue name) =
433+ line $ "Unknown value " ++ show name
391− goSimple (UnknownTypeConstructor name) = line $ "Unknown type constructor " ++ show name
434+ goSimple (UnknownTypeConstructor name) =
435+ line $ "Unknown type constructor " ++ show name
436+ goSimple (UnknownDataConstructor dc tc) =
392− goSimple (UnknownDataConstructor dc tc) = line $ "Unknown data constructor " ++ show dc ++ foldMap ((" for type constructor " ++) . show) tc
437+ line $ "Unknown data constructor " ++ show dc ++ foldMap ((" for type constructor " ++) . show) tc
438+ goSimple (ConflictingImport nm mn) =
393− goSimple (ConflictingImport nm mn) = line $ "Cannot declare `" ++ nm ++ "` since another declaration of that name was imported from `" ++ show mn ++ "`"
439+ line $ "Cannot declare `" ++ nm ++ "` since another declaration of that name was imported from `" ++ show mn ++ "`"
440+ goSimple (ConflictingImports nm m1 m2) =
394− goSimple (ConflictingImports nm m1 m2) = line $ "Conflicting imports for " ++ nm ++ " from modules " ++ show m1 ++ " and " ++ show m2
441+ line $ "Conflicting imports for " ++ nm ++ " from modules " ++ show m1 ++ " and " ++ show m2
442+ goSimple (ConflictingTypeDecls nm) =
395− goSimple (ConflictingTypeDecls nm) = line $ "Conflicting type declarations for " ++ show nm
443+ line $ "Conflicting type declarations for " ++ show nm
444+ goSimple (ConflictingCtorDecls nm) =
396− goSimple (ConflictingCtorDecls nm) = line $ "Conflicting data constructor declarations for " ++ show nm
445+ line $ "Conflicting data constructor declarations for " ++ show nm
446+ goSimple (TypeConflictsWithClass nm) =
397− goSimple (TypeConflictsWithClass nm) = line $ "Type " ++ show nm ++ " conflicts with type class declaration of the same name"
447+ line $ "Type " ++ show nm ++ " conflicts with type class declaration of the same name"
448+ goSimple (CtorConflictsWithClass nm) =
398− goSimple (CtorConflictsWithClass nm) = line $ "Data constructor " ++ show nm ++ " conflicts with type class declaration of the same name"
449+ line $ "Data constructor " ++ show nm ++ " conflicts with type class declaration of the same name"
450+ goSimple (ClassConflictsWithType nm) =
399− goSimple (ClassConflictsWithType nm) = line $ "Type class " ++ show nm ++ " conflicts with type declaration of the same name"
451+ line $ "Type class " ++ show nm ++ " conflicts with type declaration of the same name"
452+ goSimple (ClassConflictsWithCtor nm) =
400− goSimple (ClassConflictsWithCtor nm) = line $ "Type class " ++ show nm ++ " conflicts with data constructor declaration of the same name"
453+ line $ "Type class " ++ show nm ++ " conflicts with data constructor declaration of the same name"
454+ goSimple (DuplicateClassExport nm) =
401− goSimple (DuplicateClassExport nm) = line $ "Duplicate export declaration for type class " ++ show nm
455+ line $ "Duplicate export declaration for type class " ++ show nm
456+ goSimple (DuplicateValueExport nm) =
402− goSimple (DuplicateValueExport nm) = line $ "Duplicate export declaration for value " ++ show nm
457+ line $ "Duplicate export declaration for value " ++ show nm
458+ goSimple (CycleInDeclaration nm) =
403− goSimple (CycleInDeclaration nm) = line $ "Cycle in declaration of " ++ show nm
459+ line $ "Cycle in declaration of " ++ show nm
460+ goSimple (CycleInModules mns) =
404− goSimple (CycleInModules mns) = line $ "Cycle in module dependencies: " ++ intercalate ", " (map show mns)
461+ line $ "Cycle in module dependencies: " ++ intercalate ", " (map show mns)
462+ goSimple (CycleInTypeSynonym pn) =
405− goSimple (CycleInTypeSynonym pn) = line $ "Cycle in type synonym" ++ foldMap ((" " ++) . show) pn
463+ line $ "Cycle in type synonym" ++ foldMap ((" " ++) . show) pn
406− goSimple (NameIsUndefined ident) = line $ show ident ++ " is undefined"
464+ goSimple (NameIsUndefined ident) =
465+ line $ show ident ++ " is undefined"
466+ goSimple (NameNotInScope ident) =
407− goSimple (NameNotInScope ident) = line $ show ident ++ " may not be defined in the current scope"
467+ line $ show ident ++ " may not be defined in the current scope"
468+ goSimple (UndefinedTypeVariable name) =
408− goSimple (UndefinedTypeVariable name) = line $ "Type variable " ++ show name ++ " is undefined"
469+ line $ "Type variable " ++ show name ++ " is undefined"
470+ goSimple (PartiallyAppliedSynonym name) =
409− goSimple (PartiallyAppliedSynonym name) = line $ "Partially applied type synonym " ++ show name
471+ line $ "Partially applied type synonym " ++ show name
472+ goSimple (EscapedSkolem binding) =
410− goSimple (EscapedSkolem binding) = paras $ [ line "Rigid/skolem type variable has escaped." ]
473+ paras $ [ line "Rigid/skolem type variable has escaped." ]
411− <> foldMap (\expr -> [ line "Relevant expression: "
474+ <> foldMap (\expr -> [ line "Relevant expression: "
412− , indent $ line $ prettyPrintValue expr
475+ , indent $ line $ prettyPrintValue expr
413− ]) binding
476+ ]) binding
414− goSimple (TypesDoNotUnify t1 t2) = paras [ line "Cannot unify type"
477+ goSimple (TypesDoNotUnify t1 t2)
478+ = paras [ line "Cannot unify type"
415− , indent $ line $ prettyPrintType t1
479+ , indent $ line $ prettyPrintType t1
416− , line "with type"
480+ , line "with type"
417− , indent $ line $ prettyPrintType t2
481+ , indent $ line $ prettyPrintType t2
419− goSimple (KindsDoNotUnify k1 k2) = paras [ line "Cannot unify kind"
483+ goSimple (KindsDoNotUnify k1 k2) =
484+ paras [ line "Cannot unify kind"
420− , indent $ line $ prettyPrintKind k1
485+ , indent $ line $ prettyPrintKind k1
421− , line "with kind"
486+ , line "with kind"
422− , indent $ line $ prettyPrintKind k2
487+ , indent $ line $ prettyPrintKind k2
489+ goSimple (ConstrainedTypeUnified t1 t2) =
424− goSimple (ConstrainedTypeUnified t1 t2) = paras [ line "Cannot unify constrained type"
490+ paras [ line "Cannot unify constrained type"
425− , indent $ line $ prettyPrintType t1
491+ , indent $ line $ prettyPrintType t1
426− , line "with type"
492+ , line "with type"
427− , indent $ line $ prettyPrintType t2
493+ , indent $ line $ prettyPrintType t2
495+ goSimple (OverlappingInstances nm ts ds) =
429− goSimple (OverlappingInstances nm ts ds) = paras [ line $ "Overlapping instances found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
496+ paras [ line $ "Overlapping instances found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
430− , paras $ map prettyPrintDictionaryValue ds
497+ , paras $ map prettyPrintDictionaryValue ds
499+ goSimple (NoInstanceFound nm ts) =
432− goSimple (NoInstanceFound nm ts) = line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)
500+ line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)
501+ goSimple (DuplicateLabel l expr) =
433− goSimple (DuplicateLabel l expr) = paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]
502+ paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]
434− <> foldMap (\expr' -> [ line "Relevant expression: "
503+ <> foldMap (\expr' -> [ line "Relevant expression: "
435− , indent $ line $ prettyPrintValue expr'
504+ , indent $ line $ prettyPrintValue expr'
437− goSimple (DuplicateTypeArgument name) = line $ "Duplicate type argument " ++ show name
506+ goSimple (DuplicateTypeArgument name) =
507+ line $ "Duplicate type argument " ++ show name
508+ goSimple (DuplicateValueDeclaration nm) =
438− goSimple (DuplicateValueDeclaration nm) = line $ "Duplicate value declaration for " ++ show nm
509+ line $ "Duplicate value declaration for " ++ show nm
510+ goSimple (ArgListLengthsDiffer ident) =
439− goSimple (ArgListLengthsDiffer ident) = line $ "Argument list lengths differ in declaration " ++ show ident
511+ line $ "Argument list lengths differ in declaration " ++ show ident
512+ goSimple (OverlappingArgNames ident) =
440− goSimple (OverlappingArgNames ident) = line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . show) ident
513+ line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . show) ident
514+ goSimple (MissingClassMember ident) =
441− goSimple (MissingClassMember ident) = line $ "Member " ++ show ident ++ " has not been implemented"
515+ line $ "Member " ++ show ident ++ " has not been implemented"
516+ goSimple (ExpectedType kind) =
442− goSimple (ExpectedType kind) = line $ "Expected type of kind *, was " ++ prettyPrintKind kind
517+ line $ "Expected type of kind *, was " ++ prettyPrintKind kind
518+ goSimple (IncorrectConstructorArity nm) =
443− goSimple (IncorrectConstructorArity nm) = line $ "Wrong number of arguments to constructor " ++ show nm
519+ line $ "Wrong number of arguments to constructor " ++ show nm
444− goSimple SubsumptionCheckFailed = line $ "Unable to check type subsumption"
520+ goSimple SubsumptionCheckFailed = line $ "Unable to check type subsumption"
445− goSimple (ExprDoesNotHaveType expr ty) = paras [ line "Expression"
521+ goSimple (ExprDoesNotHaveType expr ty) =
522+ paras [ line "Expression"
446− , indent $ line $ prettyPrintValue expr
523+ , indent $ line $ prettyPrintValue expr
447− , line "does not have type"
524+ , line "does not have type"
448− , indent $ line $ prettyPrintType ty
525+ , indent $ line $ prettyPrintType ty
527+ goSimple (PropertyIsMissing prop row) =
450− goSimple (PropertyIsMissing prop row) = line $ "Row " ++ prettyPrintRow row ++ " lacks required property " ++ show prop
528+ line $ "Row " ++ prettyPrintRow row ++ " lacks required property " ++ show prop
529+ goSimple (CannotApplyFunction fn arg) =
451− goSimple (CannotApplyFunction fn arg) = paras [ line "Cannot apply function of type"
530+ paras [ line "Cannot apply function of type"
452− , indent $ line $ prettyPrintType fn
531+ , indent $ line $ prettyPrintType fn
453− , line "to argument"
532+ , line "to argument"
454− , indent $ line $ prettyPrintValue arg
533+ , indent $ line $ prettyPrintValue arg
535+ goSimple TypeSynonymInstance =
456− goSimple TypeSynonymInstance = line "Type synonym instances are disallowed"
536+ line "Type synonym instances are disallowed"
537+ goSimple InvalidNewtype =
457− goSimple InvalidNewtype = line "Newtypes must define a single constructor with a single argument"
538+ line "Newtypes must define a single constructor with a single argument"
539+ goSimple (InvalidInstanceHead ty) =
458− goSimple (InvalidInstanceHead ty) = paras [ line "Invalid type in class instance head:"
540+ paras [ line "Invalid type in class instance head:"
459− , indent $ line $ prettyPrintType ty
541+ , indent $ line $ prettyPrintType ty
543+ goSimple (TransitiveExportError x ys) =
461− goSimple (TransitiveExportError x ys) = paras $ (line $ "An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
544+ paras $ (line $ "An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
462− : map (line . prettyPrintExport) ys
545+ : map (line . prettyPrintExport) ys
546+ goSimple (ShadowedName nm) =
463− goSimple (ShadowedName nm) = line $ "Name '" ++ show nm ++ "' was shadowed."
547+ line $ "Name '" ++ show nm ++ "' was shadowed."
548+ goSimple (ClassOperator className opName) =
549+ paras [ line $ "Class '" ++ show className ++ "' declares operator " ++ show opName ++ "."
550+ , indent $ line $ "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
551+ , indent $ line $ show opName ++ " = someMember"
553+ goSimple (WildcardInferredType ty) =
464− goSimple (WildcardInferredType ty) = line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
554+ line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
465− goSimple PreludeNotPresent = paras [ line $ "There is no Prelude module loaded, and the --no-prelude option was not specified."
555+ go (NotYetDefined names err) =
466− , line $ "You probably need to install the Prelude and other dependencies using Bower."
468− go (NotYetDefined names err) = paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"
556+ paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"
469− , indent $ go err
557+ , indent $ go err
471− go (ErrorUnifyingTypes t1 t2 err) = paras [ line "Error unifying type "
559+ go (ErrorUnifyingTypes t1 t2 err) =
560+ paras [ line "Error unifying type "
472− , indent $ line $ prettyPrintType t1
561+ , indent $ line $ prettyPrintType t1
473− , line "with type"
562+ , line "with type"
474− , indent $ line $ prettyPrintType t2
563+ , indent $ line $ prettyPrintType t2
475− , go err
564+ , go err
477− go (ErrorInExpression expr err) = paras [ line "Error in expression:"
566+ go (ErrorInExpression expr err) =
567+ paras [ line "Error in expression:"
478− , indent $ line $ prettyPrintValue expr
568+ , indent $ line $ prettyPrintValue expr
479− , go err
569+ , go err
571+ go (ErrorInModule mn err) =
481− go (ErrorInModule mn err) = paras [ line $ "Error in module " ++ show mn ++ ":"
572+ paras [ line $ "Error in module " ++ show mn ++ ":"
482− , go err
573+ , go err
575+ go (ErrorInSubsumption t1 t2 err) =
484− go (ErrorInSubsumption t1 t2 err) = paras [ line "Error checking that type "
576+ paras [ line "Error checking that type "
485− , indent $ line $ prettyPrintType t1
577+ , indent $ line $ prettyPrintType t1
486− , line "subsumes type"
578+ , line "subsumes type"
487− , indent $ line $ prettyPrintType t2
579+ , indent $ line $ prettyPrintType t2
488− , go err
580+ , go err
582+ go (ErrorInInstance name ts err) =
490− go (ErrorInInstance name ts err) = paras [ line $ "Error in type class instance " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
583+ paras [ line $ "Error in type class instance " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
491− , go err
584+ , go err
586+ go (ErrorCheckingKind ty err) =
493− go (ErrorCheckingKind ty err) = paras [ line "Error checking kind of type "
587+ paras [ line "Error checking kind of type "
494− , indent $ line $ prettyPrintType ty
588+ , indent $ line $ prettyPrintType ty
495− , go err
589+ , go err
591+ go (ErrorInferringType expr err) =
497− go (ErrorInferringType expr err) = paras [ line "Error inferring type of value "
592+ paras [ line "Error inferring type of value "
498− , indent $ line $ prettyPrintValue expr
593+ , indent $ line $ prettyPrintValue expr
499− , go err
594+ , go err
596+ go (ErrorCheckingType expr ty err) =
501− go (ErrorCheckingType expr ty err) = paras [ line "Error checking that value "
597+ paras [ line "Error checking that value "
502− , indent $ line $ prettyPrintValue expr
598+ , indent $ line $ prettyPrintValue expr
503− , line "has type"
599+ , line "has type"
504− , indent $ line $ prettyPrintType ty
600+ , indent $ line $ prettyPrintType ty
505− , go err
601+ , go err
603+ go (ErrorInApplication f t a err) =
507− go (ErrorInApplication f t a err) = paras [ line "Error applying function"
604+ paras [ line "Error applying function"
508− , indent $ line $ prettyPrintValue f
605+ , indent $ line $ prettyPrintValue f
509− , line "of type"
606+ , line "of type"
510− , indent $ line $ prettyPrintType t
607+ , indent $ line $ prettyPrintType t
511− , line "to argument"
608+ , line "to argument"
512− , indent $ line $ prettyPrintValue a
609+ , indent $ line $ prettyPrintValue a
513− , go err
610+ , go err
612+ go (ErrorInDataConstructor nm err) =
515− go (ErrorInDataConstructor nm err) = paras [ line $ "Error in data constructor " ++ show nm ++ ":"
613+ paras [ line $ "Error in data constructor " ++ show nm ++ ":"
516− , go err
614+ , go err
616+ go (ErrorInTypeConstructor nm err) =
518− go (ErrorInTypeConstructor nm err) = paras [ line $ "Error in type constructor " ++ show nm ++ ":"
617+ paras [ line $ "Error in type constructor " ++ show nm ++ ":"
519− , go err
618+ , go err
620+ go (ErrorInBindingGroup nms err) =
521− go (ErrorInBindingGroup nms err) = paras [ line $ "Error in binding group " ++ intercalate ", " (map show nms) ++ ":"
621+ paras [ line $ "Error in binding group " ++ intercalate ", " (map show nms) ++ ":"
522− , go err
622+ , go err
624+ go (ErrorInDataBindingGroup err) =
524− go (ErrorInDataBindingGroup err) = paras [ line $ "Error in data binding group:"
625+ paras [ line $ "Error in data binding group:"
525− , go err
626+ , go err
628+ go (ErrorInTypeSynonym name err) =
527− go (ErrorInTypeSynonym name err) = paras [ line $ "Error in type synonym " ++ show name ++ ":"
629+ paras [ line $ "Error in type synonym " ++ show name ++ ":"
528− , go err
630+ , go err
632+ go (ErrorInValueDeclaration n err) =
530− go (ErrorInValueDeclaration n err) = paras [ line $ "Error in value declaration " ++ show n ++ ":"
633+ paras [ line $ "Error in value declaration " ++ show n ++ ":"
531− , go err
634+ , go err
636+ go (ErrorInForeignImport nm err) =
533− go (ErrorInForeignImport nm err) = paras [ line $ "Error in foreign import " ++ show nm ++ ":"
637+ paras [ line $ "Error in foreign import " ++ show nm ++ ":"
534− , go err
638+ , go err
640+ go (PositionedError srcSpan err) =
536− go (PositionedError srcSpan err) = paras [ line $ "Error at " ++ displaySourceSpan srcSpan ++ ":"
641+ paras [ line $ "Error at " ++ displaySourceSpan srcSpan ++ ":"
537− , indent $ go err
642+ , indent $ go err
539− go (SimpleErrorWrapper sem) = goSimple sem
644+ go (SimpleErrorWrapper sem) = goSimple sem
541 line :: String -> Box.Box
646 line :: String -> Box.Box
542 line = Box.text
647 line = Box.text
@@ -570,10 +675,10 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
570 prettyPrintDictionaryValue (SubclassDictionaryValue sup nm _) = paras [ line $ (show nm) ++ " via superclass"
675 prettyPrintDictionaryValue (SubclassDictionaryValue sup nm _) = paras [ line $ (show nm) ++ " via superclass"
571 , indent $ prettyPrintDictionaryValue sup
676 , indent $ prettyPrintDictionaryValue sup
575 -- Pretty print and export declaration
680 -- Pretty print and export declaration
577 prettyPrintExport :: DeclarationRef -> String
682 prettyPrintExport :: DeclarationRef -> String
578 prettyPrintExport (TypeRef pn _) = show pn
683 prettyPrintExport (TypeRef pn _) = show pn
579 prettyPrintExport (ValueRef ident) = show ident
684 prettyPrintExport (ValueRef ident) = show ident