@@ -54,6 +54,9 @@ data SimpleErrorMessage
5454 | ErrorParsingFFIModule FilePath
5555 | ErrorParsingPrelude P.ParseError
5656 | ErrorParsingModule P.ParseError
57+ | MissingFFIModule ModuleName
58+ | MultipleFFIModules ModuleName FilePath FilePath
59+ | UnnecessaryFFIModule ModuleName FilePath
5760 | InvalidExternsFile FilePath
5861 | CannotGetFileInfo FilePath
5962 | CannotReadFile FilePath
@@ -160,6 +163,9 @@ errorCode em = case unwrapErrorMessage em of
160163 (ErrorParsingFFIModule _) -> "ErrorParsingFFIModule"
161164 (ErrorParsingPrelude _) -> "ErrorParsingPrelude"
162165 (ErrorParsingModule _) -> "ErrorParsingModule"
166+ MissingFFIModule{} -> "MissingFFIModule"
167+ MultipleFFIModules{} -> "MultipleFFIModules"
168+ UnnecessaryFFIModule{} -> "UnnecessaryFFIModule"
163169 (InvalidExternsFile _) -> "InvalidExternsFile"
164170 (CannotGetFileInfo _) -> "CannotGetFileInfo"
165171 (CannotReadFile _) -> "CannotReadFile"
@@ -354,199 +360,295 @@ prettyPrintSingleError full e = prettyPrintErrorMessage <$> onTypesInErrorMessag
354360 wikiUri = "https://github.com/purescript/purescript/wiki/Error-Code-" ++ errorCode e
355361
356362 go :: ErrorMessage -> Box.Box
357− goSimple (CannotGetFileInfo path) = paras [ line "Unable to read file info: "
358− , indent . line $ path
359− ]
360− goSimple (CannotReadFile path) = paras [ line "Unable to read file: "
361− , indent . line $ path
362− ]
363− goSimple (CannotWriteFile path) = paras [ line "Unable to write file: "
364− , indent . line $ path
365− ]
366− goSimple (ErrorParsingExterns err) = paras [ line "Error parsing externs files: "
367− , indent . line . show $ err
368− ]
369− goSimple (ErrorParsingFFIModule path) = paras [ line "Unable to parse module from FFI file: "
370− , indent . line $ path
371− ]
372− goSimple (ErrorParsingModule err) = paras [ line "Unable to parse module: "
373− , indent . line . show $ err
374− ]
375− goSimple (ErrorParsingPrelude err) = paras [ line "Error parsing prelude: "
376− , indent . line . show $ err
377− ]
378− goSimple (InvalidExternsFile path) = paras [ line "Externs file is invalid: "
379− , indent . line $ path
380− ]
381− goSimple InvalidDoBind = line "Bind statement cannot be the last statement in a do block"
382− goSimple InvalidDoLet = line "Let statement cannot be the last statement in a do block"
383− goSimple CannotReorderOperators = line "Unable to reorder operators"
384− goSimple UnspecifiedSkolemScope = line "Skolem variable scope is unspecified"
385− goSimple OverlappingNamesInLet = line "Overlapping names in let binding."
386− goSimple (InfiniteType ty) = paras [ line "Infinite type detected: "
387− , indent $ line $ prettyPrintType ty
388− ]
389− goSimple (InfiniteKind ki) = paras [ line "Infinite kind detected: "
390− , indent $ line $ prettyPrintKind ki
391− ]
392− goSimple (MultipleFixities name) = line $ "Multiple fixity declarations for " ++ show name
393− goSimple (OrphanTypeDeclaration nm) = line $ "Orphan type declaration for " ++ show nm
394− goSimple (OrphanFixityDeclaration op) = line $ "Orphan fixity declaration for " ++ show op
395− goSimple (RedefinedModule name) = line $ "Module " ++ show name ++ " has been defined multiple times"
396− goSimple (RedefinedIdent name) = line $ "Name " ++ show name ++ " has been defined multiple times"
397− goSimple (UnknownModule mn) = line $ "Unknown module " ++ show mn
398− goSimple (UnknownType name) = line $ "Unknown type " ++ show name
399− goSimple (UnknownTypeClass name) = line $ "Unknown type class " ++ show name
400− goSimple (UnknownValue name) = line $ "Unknown value " ++ show name
401− goSimple (UnknownTypeConstructor name) = line $ "Unknown type constructor " ++ show name
402− goSimple (UnknownDataConstructor dc tc) = line $ "Unknown data constructor " ++ show dc ++ foldMap ((" for type constructor " ++) . show) tc
403− goSimple (ConflictingImport nm mn) = line $ "Cannot declare `" ++ nm ++ "` since another declaration of that name was imported from `" ++ show mn ++ "`"
404− goSimple (ConflictingImports nm m1 m2) = line $ "Conflicting imports for " ++ nm ++ " from modules " ++ show m1 ++ " and " ++ show m2
405− goSimple (ConflictingTypeDecls nm) = line $ "Conflicting type declarations for " ++ show nm
406− goSimple (ConflictingCtorDecls nm) = line $ "Conflicting data constructor declarations for " ++ show nm
407− goSimple (TypeConflictsWithClass nm) = line $ "Type " ++ show nm ++ " conflicts with type class declaration of the same name"
408− goSimple (CtorConflictsWithClass nm) = line $ "Data constructor " ++ show nm ++ " conflicts with type class declaration of the same name"
409− goSimple (ClassConflictsWithType nm) = line $ "Type class " ++ show nm ++ " conflicts with type declaration of the same name"
410− goSimple (ClassConflictsWithCtor nm) = line $ "Type class " ++ show nm ++ " conflicts with data constructor declaration of the same name"
411− goSimple (DuplicateClassExport nm) = line $ "Duplicate export declaration for type class " ++ show nm
412− goSimple (DuplicateValueExport nm) = line $ "Duplicate export declaration for value " ++ show nm
413− goSimple (CycleInDeclaration nm) = line $ "Cycle in declaration of " ++ show nm
414− goSimple (CycleInModules mns) = line $ "Cycle in module dependencies: " ++ intercalate ", " (map show mns)
415− goSimple (CycleInTypeSynonym pn) = line $ "Cycle in type synonym" ++ foldMap ((" " ++) . show) pn
416− goSimple (NameIsUndefined ident) = line $ show ident ++ " is undefined"
417− goSimple (NameNotInScope ident) = line $ show ident ++ " may not be defined in the current scope"
418− goSimple (UndefinedTypeVariable name) = line $ "Type variable " ++ show name ++ " is undefined"
419− goSimple (PartiallyAppliedSynonym name) = line $ "Partially applied type synonym " ++ show name
420− goSimple (EscapedSkolem binding) = paras $ [ line "Rigid/skolem type variable has escaped." ]
421− <> foldMap (\expr -> [ line "Relevant expression: "
422− , indent $ line $ prettyPrintValue expr
423− ]) binding
424− goSimple (TypesDoNotUnify t1 t2) = paras [ line "Cannot unify type"
425− , indent $ line $ prettyPrintType t1
426− , line "with type"
427− , indent $ line $ prettyPrintType t2
428− ]
429− goSimple (KindsDoNotUnify k1 k2) = paras [ line "Cannot unify kind"
430− , indent $ line $ prettyPrintKind k1
431− , line "with kind"
432− , indent $ line $ prettyPrintKind k2
433− ]
434− goSimple (ConstrainedTypeUnified t1 t2) = paras [ line "Cannot unify constrained type"
435− , indent $ line $ prettyPrintType t1
436− , line "with type"
437− , indent $ line $ prettyPrintType t2
438− ]
439− goSimple (OverlappingInstances nm ts ds) = paras [ line $ "Overlapping instances found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
440− , paras $ map prettyPrintDictionaryValue ds
441− ]
442− goSimple (NoInstanceFound nm ts) = line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)
443− goSimple (DuplicateLabel l expr) = paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]
444− <> foldMap (\expr' -> [ line "Relevant expression: "
445− , indent $ line $ prettyPrintValue expr'
446− ]) expr
447− goSimple (DuplicateTypeArgument name) = line $ "Duplicate type argument " ++ show name
448− goSimple (DuplicateValueDeclaration nm) = line $ "Duplicate value declaration for " ++ show nm
449− goSimple (ArgListLengthsDiffer ident) = line $ "Argument list lengths differ in declaration " ++ show ident
450− goSimple (OverlappingArgNames ident) = line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . show) ident
451− goSimple (MissingClassMember ident) = line $ "Member " ++ show ident ++ " has not been implemented"
452− goSimple (ExpectedType kind) = line $ "Expected type of kind *, was " ++ prettyPrintKind kind
453− goSimple (IncorrectConstructorArity nm) = line $ "Wrong number of arguments to constructor " ++ show nm
454− goSimple SubsumptionCheckFailed = line $ "Unable to check type subsumption"
455− goSimple (ExprDoesNotHaveType expr ty) = paras [ line "Expression"
456− , indent $ line $ prettyPrintValue expr
457− , line "does not have type"
458− , indent $ line $ prettyPrintType ty
459− ]
460− goSimple (PropertyIsMissing prop row) = line $ "Row " ++ prettyPrintRow row ++ " lacks required property " ++ show prop
461− goSimple (CannotApplyFunction fn arg) = paras [ line "Cannot apply function of type"
462− , indent $ line $ prettyPrintType fn
463− , line "to argument"
464− , indent $ line $ prettyPrintValue arg
465− ]
466− goSimple TypeSynonymInstance = line "Type synonym instances are disallowed"
467− goSimple InvalidNewtype = line "Newtypes must define a single constructor with a single argument"
468− goSimple (InvalidInstanceHead ty) = paras [ line "Invalid type in class instance head:"
469− , indent $ line $ prettyPrintType ty
470− ]
471− goSimple (TransitiveExportError x ys) = paras $ (line $ "An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
472− : map (line . prettyPrintExport) ys
473− goSimple (ShadowedName nm) = line $ "Name '" ++ show nm ++ "' was shadowed."
474− goSimple (WildcardInferredType ty) = line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
475− goSimple PreludeNotPresent = paras [ line $ "There is no Prelude module loaded, and the --no-prelude option was not specified."
476− , line $ "You probably need to install the Prelude and other dependencies using Bower."
477− ]
478− go (NotYetDefined names err) = paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"
479− , indent $ go err
480− ]
481− go (ErrorUnifyingTypes t1 t2 err) = paras [ line "Error unifying type "
482− , indent $ line $ prettyPrintType t1
483− , line "with type"
484− , indent $ line $ prettyPrintType t2
485− , go err
486− ]
487− go (ErrorInExpression expr err) = paras [ line "Error in expression:"
488− , indent $ line $ prettyPrintValue expr
489− , go err
490− ]
491− go (ErrorInModule mn err) = paras [ line $ "Error in module " ++ show mn ++ ":"
492− , go err
493− ]
494− go (ErrorInSubsumption t1 t2 err) = paras [ line "Error checking that type "
495− , indent $ line $ prettyPrintType t1
496− , line "subsumes type"
497− , indent $ line $ prettyPrintType t2
498− , go err
499− ]
500− go (ErrorInInstance name ts err) = paras [ line $ "Error in type class instance " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
501− , go err
502− ]
503− go (ErrorCheckingKind ty err) = paras [ line "Error checking kind of type "
504− , indent $ line $ prettyPrintType ty
505− , go err
506− ]
507− go (ErrorInferringType expr err) = paras [ line "Error inferring type of value "
508− , indent $ line $ prettyPrintValue expr
509− , go err
510− ]
511− go (ErrorCheckingType expr ty err) = paras [ line "Error checking that value "
512− , indent $ line $ prettyPrintValue expr
513− , line "has type"
514− , indent $ line $ prettyPrintType ty
515− , go err
516− ]
517− go (ErrorInApplication f t a err) = paras [ line "Error applying function"
518− , indent $ line $ prettyPrintValue f
519− , line "of type"
520− , indent $ line $ prettyPrintType t
521− , line "to argument"
522− , indent $ line $ prettyPrintValue a
523− , go err
524− ]
525− go (ErrorInDataConstructor nm err) = paras [ line $ "Error in data constructor " ++ show nm ++ ":"
526− , go err
527− ]
528− go (ErrorInTypeConstructor nm err) = paras [ line $ "Error in type constructor " ++ show nm ++ ":"
529− , go err
530− ]
531− go (ErrorInBindingGroup nms err) = paras [ line $ "Error in binding group " ++ intercalate ", " (map show nms) ++ ":"
532− , go err
533− ]
534− go (ErrorInDataBindingGroup err) = paras [ line $ "Error in data binding group:"
535− , go err
536− ]
537− go (ErrorInTypeSynonym name err) = paras [ line $ "Error in type synonym " ++ show name ++ ":"
538− , go err
539− ]
540− go (ErrorInValueDeclaration n err) = paras [ line $ "Error in value declaration " ++ show n ++ ":"
541− , go err
542− ]
543− go (ErrorInForeignImport nm err) = paras [ line $ "Error in foreign import " ++ show nm ++ ":"
544− , go err
545− ]
546− go (PositionedError srcSpan err) = paras [ line $ "Error at " ++ displaySourceSpan srcSpan ++ ":"
547− , indent $ go err
548− ]
549− go (SimpleErrorWrapper sem) = goSimple sem
363+ goSimple (CannotGetFileInfo path) =
364+ paras [ line "Unable to read file info: "
365+ , indent . line $ path
366+ ]
367+ goSimple (CannotReadFile path) =
368+ paras [ line "Unable to read file: "
369+ , indent . line $ path
370+ ]
371+ goSimple (CannotWriteFile path) =
372+ paras [ line "Unable to write file: "
373+ , indent . line $ path
374+ ]
375+ goSimple (ErrorParsingExterns err) =
376+ paras [ line "Error parsing externs files: "
377+ , indent . line . show $ err
378+ ]
379+ goSimple (ErrorParsingFFIModule path) =
380+ paras [ line "Unable to parse module from FFI file: "
381+ , indent . line $ path
382+ ]
383+ goSimple (ErrorParsingModule err) =
384+ paras [ line "Unable to parse module: "
385+ , indent . line . show $ err
386+ ]
387+ goSimple (MissingFFIModule mn) =
388+ line $ "Missing FFI implementations for module " ++ show mn
389+ goSimple (UnnecessaryFFIModule mn path) =
390+ paras [ line $ "Unnecessary FFI implementations have been provided for module " ++ show mn ++ ": "
391+ , indent . line $ path
392+ ]
393+ goSimple (MultipleFFIModules mn path1 path2) =
394+ paras [ line $ "Multiple FFI implementations have been provided for module " ++ show mn ++ ": "
395+ , indent . line $ path1
396+ , indent . line $ path2
397+ ]
398+ goSimple (ErrorParsingPrelude err) =
399+ paras [ line "Error parsing prelude: "
400+ , indent . line . show $ err
401+ ]
402+ goSimple (InvalidExternsFile path) =
403+ paras [ line "Externs file is invalid: "
404+ , indent . line $ path
405+ ]
406+ goSimple InvalidDoBind =
407+ line "Bind statement cannot be the last statement in a do block"
408+ goSimple InvalidDoLet =
409+ line "Let statement cannot be the last statement in a do block"
410+ goSimple CannotReorderOperators =
411+ line "Unable to reorder operators"
412+ goSimple UnspecifiedSkolemScope =
413+ line "Skolem variable scope is unspecified"
414+ goSimple OverlappingNamesInLet =
415+ line "Overlapping names in let binding."
416+ goSimple (InfiniteType ty) =
417+ paras [ line "Infinite type detected: "
418+ , indent $ line $ prettyPrintType ty
419+ ]
420+ goSimple (InfiniteKind ki) =
421+ paras [ line "Infinite kind detected: "
422+ , indent $ line $ prettyPrintKind ki
423+ ]
424+ goSimple (MultipleFixities name) =
425+ line $ "Multiple fixity declarations for " ++ show name
426+ goSimple (OrphanTypeDeclaration nm) =
427+ line $ "Orphan type declaration for " ++ show nm
428+ goSimple (OrphanFixityDeclaration op) =
429+ line $ "Orphan fixity declaration for " ++ show op
430+ goSimple (RedefinedModule name) =
431+ line $ "Module " ++ show name ++ " has been defined multiple times"
432+ goSimple (RedefinedIdent name) =
433+ line $ "Name " ++ show name ++ " has been defined multiple times"
434+ goSimple (UnknownModule mn) =
435+ line $ "Unknown module " ++ show mn
436+ goSimple (UnknownType name) =
437+ line $ "Unknown type " ++ show name
438+ goSimple (UnknownTypeClass name) =
439+ line $ "Unknown type class " ++ show name
440+ goSimple (UnknownValue name) =
441+ line $ "Unknown value " ++ show name
442+ goSimple (UnknownTypeConstructor name) =
443+ line $ "Unknown type constructor " ++ show name
444+ goSimple (UnknownDataConstructor dc tc) =
445+ line $ "Unknown data constructor " ++ show dc ++ foldMap ((" for type constructor " ++) . show) tc
446+ goSimple (ConflictingImport nm mn) =
447+ line $ "Cannot declare `" ++ nm ++ "` since another declaration of that name was imported from `" ++ show mn ++ "`"
448+ goSimple (ConflictingImports nm m1 m2) =
449+ line $ "Conflicting imports for " ++ nm ++ " from modules " ++ show m1 ++ " and " ++ show m2
450+ goSimple (ConflictingTypeDecls nm) =
451+ line $ "Conflicting type declarations for " ++ show nm
452+ goSimple (ConflictingCtorDecls nm) =
453+ line $ "Conflicting data constructor declarations for " ++ show nm
454+ goSimple (TypeConflictsWithClass nm) =
455+ line $ "Type " ++ show nm ++ " conflicts with type class declaration of the same name"
456+ goSimple (CtorConflictsWithClass nm) =
457+ line $ "Data constructor " ++ show nm ++ " conflicts with type class declaration of the same name"
458+ goSimple (ClassConflictsWithType nm) =
459+ line $ "Type class " ++ show nm ++ " conflicts with type declaration of the same name"
460+ goSimple (ClassConflictsWithCtor nm) =
461+ line $ "Type class " ++ show nm ++ " conflicts with data constructor declaration of the same name"
462+ goSimple (DuplicateClassExport nm) =
463+ line $ "Duplicate export declaration for type class " ++ show nm
464+ goSimple (DuplicateValueExport nm) =
465+ line $ "Duplicate export declaration for value " ++ show nm
466+ goSimple (CycleInDeclaration nm) =
467+ line $ "Cycle in declaration of " ++ show nm
468+ goSimple (CycleInModules mns) =
469+ line $ "Cycle in module dependencies: " ++ intercalate ", " (map show mns)
470+ goSimple (CycleInTypeSynonym pn) =
471+ line $ "Cycle in type synonym" ++ foldMap ((" " ++) . show) pn
472+ goSimple (NameIsUndefined ident) =
473+ line $ show ident ++ " is undefined"
474+ goSimple (NameNotInScope ident) =
475+ line $ show ident ++ " may not be defined in the current scope"
476+ goSimple (UndefinedTypeVariable name) =
477+ line $ "Type variable " ++ show name ++ " is undefined"
478+ goSimple (PartiallyAppliedSynonym name) =
479+ line $ "Partially applied type synonym " ++ show name
480+ goSimple (EscapedSkolem binding) =
481+ paras $ [ line "Rigid/skolem type variable has escaped." ]
482+ <> foldMap (\expr -> [ line "Relevant expression: "
483+ , indent $ line $ prettyPrintValue expr
484+ ]) binding
485+ goSimple (TypesDoNotUnify t1 t2)
486+ = paras [ line "Cannot unify type"
487+ , indent $ line $ prettyPrintType t1
488+ , line "with type"
489+ , indent $ line $ prettyPrintType t2
490+ ]
491+ goSimple (KindsDoNotUnify k1 k2) =
492+ paras [ line "Cannot unify kind"
493+ , indent $ line $ prettyPrintKind k1
494+ , line "with kind"
495+ , indent $ line $ prettyPrintKind k2
496+ ]
497+ goSimple (ConstrainedTypeUnified t1 t2) =
498+ paras [ line "Cannot unify constrained type"
499+ , indent $ line $ prettyPrintType t1
500+ , line "with type"
501+ , indent $ line $ prettyPrintType t2
502+ ]
503+ goSimple (OverlappingInstances nm ts ds) =
504+ paras [ line $ "Overlapping instances found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
505+ , paras $ map prettyPrintDictionaryValue ds
506+ ]
507+ goSimple (NoInstanceFound nm ts) =
508+ line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)
509+ goSimple (DuplicateLabel l expr) =
510+ paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]
511+ <> foldMap (\expr' -> [ line "Relevant expression: "
512+ , indent $ line $ prettyPrintValue expr'
513+ ]) expr
514+ goSimple (DuplicateTypeArgument name) =
515+ line $ "Duplicate type argument " ++ show name
516+ goSimple (DuplicateValueDeclaration nm) =
517+ line $ "Duplicate value declaration for " ++ show nm
518+ goSimple (ArgListLengthsDiffer ident) =
519+ line $ "Argument list lengths differ in declaration " ++ show ident
520+ goSimple (OverlappingArgNames ident) =
521+ line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . show) ident
522+ goSimple (MissingClassMember ident) =
523+ line $ "Member " ++ show ident ++ " has not been implemented"
524+ goSimple (ExpectedType kind) =
525+ line $ "Expected type of kind *, was " ++ prettyPrintKind kind
526+ goSimple (IncorrectConstructorArity nm) =
527+ line $ "Wrong number of arguments to constructor " ++ show nm
528+ goSimple SubsumptionCheckFailed = line $ "Unable to check type subsumption"
529+ goSimple (ExprDoesNotHaveType expr ty) =
530+ paras [ line "Expression"
531+ , indent $ line $ prettyPrintValue expr
532+ , line "does not have type"
533+ , indent $ line $ prettyPrintType ty
534+ ]
535+ goSimple (PropertyIsMissing prop row) =
536+ line $ "Row " ++ prettyPrintRow row ++ " lacks required property " ++ show prop
537+ goSimple (CannotApplyFunction fn arg) =
538+ paras [ line "Cannot apply function of type"
539+ , indent $ line $ prettyPrintType fn
540+ , line "to argument"
541+ , indent $ line $ prettyPrintValue arg
542+ ]
543+ goSimple TypeSynonymInstance =
544+ line "Type synonym instances are disallowed"
545+ goSimple InvalidNewtype =
546+ line "Newtypes must define a single constructor with a single argument"
547+ goSimple (InvalidInstanceHead ty) =
548+ paras [ line "Invalid type in class instance head:"
549+ , indent $ line $ prettyPrintType ty
550+ ]
551+ goSimple (TransitiveExportError x ys) =
552+ paras $ (line $ "An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
553+ : map (line . prettyPrintExport) ys
554+ goSimple (ShadowedName nm) =
555+ line $ "Name '" ++ show nm ++ "' was shadowed."
556+ goSimple (WildcardInferredType ty) =
557+ line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
558+ goSimple PreludeNotPresent =
559+ paras [ line $ "There is no Prelude module loaded, and the --no-prelude option was not specified."
560+ , line $ "You probably need to install the Prelude and other dependencies using Bower."
561+ ]
562+ go (NotYetDefined names err) =
563+ paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"
564+ , indent $ go err
565+ ]
566+ go (ErrorUnifyingTypes t1 t2 err) =
567+ paras [ line "Error unifying type "
568+ , indent $ line $ prettyPrintType t1
569+ , line "with type"
570+ , indent $ line $ prettyPrintType t2
571+ , go err
572+ ]
573+ go (ErrorInExpression expr err) =
574+ paras [ line "Error in expression:"
575+ , indent $ line $ prettyPrintValue expr
576+ , go err
577+ ]
578+ go (ErrorInModule mn err) =
579+ paras [ line $ "Error in module " ++ show mn ++ ":"
580+ , go err
581+ ]
582+ go (ErrorInSubsumption t1 t2 err) =
583+ paras [ line "Error checking that type "
584+ , indent $ line $ prettyPrintType t1
585+ , line "subsumes type"
586+ , indent $ line $ prettyPrintType t2
587+ , go err
588+ ]
589+ go (ErrorInInstance name ts err) =
590+ paras [ line $ "Error in type class instance " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"
591+ , go err
592+ ]
593+ go (ErrorCheckingKind ty err) =
594+ paras [ line "Error checking kind of type "
595+ , indent $ line $ prettyPrintType ty
596+ , go err
597+ ]
598+ go (ErrorInferringType expr err) =
599+ paras [ line "Error inferring type of value "
600+ , indent $ line $ prettyPrintValue expr
601+ , go err
602+ ]
603+ go (ErrorCheckingType expr ty err) =
604+ paras [ line "Error checking that value "
605+ , indent $ line $ prettyPrintValue expr
606+ , line "has type"
607+ , indent $ line $ prettyPrintType ty
608+ , go err
609+ ]
610+ go (ErrorInApplication f t a err) =
611+ paras [ line "Error applying function"
612+ , indent $ line $ prettyPrintValue f
613+ , line "of type"
614+ , indent $ line $ prettyPrintType t
615+ , line "to argument"
616+ , indent $ line $ prettyPrintValue a
617+ , go err
618+ ]
619+ go (ErrorInDataConstructor nm err) =
620+ paras [ line $ "Error in data constructor " ++ show nm ++ ":"
621+ , go err
622+ ]
623+ go (ErrorInTypeConstructor nm err) =
624+ paras [ line $ "Error in type constructor " ++ show nm ++ ":"
625+ , go err
626+ ]
627+ go (ErrorInBindingGroup nms err) =
628+ paras [ line $ "Error in binding group " ++ intercalate ", " (map show nms) ++ ":"
629+ , go err
630+ ]
631+ go (ErrorInDataBindingGroup err) =
632+ paras [ line $ "Error in data binding group:"
633+ , go err
634+ ]
635+ go (ErrorInTypeSynonym name err) =
636+ paras [ line $ "Error in type synonym " ++ show name ++ ":"
637+ , go err
638+ ]
639+ go (ErrorInValueDeclaration n err) =
640+ paras [ line $ "Error in value declaration " ++ show n ++ ":"
641+ , go err
642+ ]
643+ go (ErrorInForeignImport nm err) =
644+ paras [ line $ "Error in foreign import " ++ show nm ++ ":"
645+ , go err
646+ ]
647+ go (PositionedError srcSpan err) =
648+ paras [ line $ "Error at " ++ displaySourceSpan srcSpan ++ ":"
649+ , indent $ go err
650+ ]
651+ go (SimpleErrorWrapper sem) = goSimple sem
550652
551653 line :: String -> Box.Box
552654 line = Box.text