@@ -457,19 +457,19 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
457 renderSimpleErrorMessage (UnknownDataConstructor dc tc) =
457 renderSimpleErrorMessage (UnknownDataConstructor dc tc) =
458 line $ "Unknown data constructor " ++ showQualified runProperName dc ++ foldMap ((" for type constructor " ++) . showQualified runProperName) tc
458 line $ "Unknown data constructor " ++ showQualified runProperName dc ++ foldMap ((" for type constructor " ++) . showQualified runProperName) tc
459 renderSimpleErrorMessage (UnknownImportType mn name) =
459 renderSimpleErrorMessage (UnknownImportType mn name) =
460− paras [ line $ "Cannot import the type " ++ runProperName name ++ " from module " ++ runModuleName mn
460+ paras [ line $ "Cannot import type " ++ runProperName name ++ " from module " ++ runModuleName mn
461 , line "It either does not exist or the module does not export it."
461 , line "It either does not exist or the module does not export it."
463 renderSimpleErrorMessage (UnknownExportType name) =
463 renderSimpleErrorMessage (UnknownExportType name) =
464 line $ "Cannot export unknown type " ++ runProperName name
464 line $ "Cannot export unknown type " ++ runProperName name
465 renderSimpleErrorMessage (UnknownImportTypeClass mn name) =
465 renderSimpleErrorMessage (UnknownImportTypeClass mn name) =
466− paras [ line $ "Cannot import the type class " ++ runProperName name ++ " from module " ++ runModuleName mn
466+ paras [ line $ "Cannot import type class " ++ runProperName name ++ " from module " ++ runModuleName mn
467 , line "It either does not exist or the module does not export it."
467 , line "It either does not exist or the module does not export it."
469 renderSimpleErrorMessage (UnknownExportTypeClass name) =
469 renderSimpleErrorMessage (UnknownExportTypeClass name) =
470 line $ "Cannot export unknown type class " ++ runProperName name
470 line $ "Cannot export unknown type class " ++ runProperName name
471 renderSimpleErrorMessage (UnknownImportValue mn name) =
471 renderSimpleErrorMessage (UnknownImportValue mn name) =
472− paras [ line $ "Cannot import the value " ++ showIdent name ++ " from module " ++ runModuleName mn
472+ paras [ line $ "Cannot import value " ++ showIdent name ++ " from module " ++ runModuleName mn
473 , line "It either does not exist or the module does not export it."
473 , line "It either does not exist or the module does not export it."
475 renderSimpleErrorMessage (UnknownExportValue name) =
475 renderSimpleErrorMessage (UnknownExportValue name) =
@@ -483,7 +483,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
483 renderSimpleErrorMessage (UnknownExportDataConstructor tcon dcon) =
483 renderSimpleErrorMessage (UnknownExportDataConstructor tcon dcon) =
484 line $ "Cannot export data constructor " ++ runProperName dcon ++ " for type " ++ runProperName tcon ++ ", as it has not been declared."
484 line $ "Cannot export data constructor " ++ runProperName dcon ++ " for type " ++ runProperName tcon ++ ", as it has not been declared."
485 renderSimpleErrorMessage (ConflictingImport nm mn) =
485 renderSimpleErrorMessage (ConflictingImport nm mn) =
486− paras [ line $ "Cannot declare " ++ show nm ++ ", since another declaration of that name was imported from the module " ++ runModuleName mn
486+ paras [ line $ "Cannot declare " ++ show nm ++ ", since another declaration of that name was imported from module " ++ runModuleName mn
487 , line $ "Consider hiding " ++ show nm ++ " when importing " ++ runModuleName mn ++ ":"
487 , line $ "Consider hiding " ++ show nm ++ " when importing " ++ runModuleName mn ++ ":"
488 , indent . line $ "import " ++ runModuleName mn ++ " hiding (" ++ nm ++ ")"
488 , indent . line $ "import " ++ runModuleName mn ++ " hiding (" ++ nm ++ ")"
@@ -494,15 +494,15 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
494 renderSimpleErrorMessage (ConflictingCtorDecls nm) =
494 renderSimpleErrorMessage (ConflictingCtorDecls nm) =
495 line $ "Conflicting data constructor declarations for " ++ runProperName nm
495 line $ "Conflicting data constructor declarations for " ++ runProperName nm
496 renderSimpleErrorMessage (TypeConflictsWithClass nm) =
496 renderSimpleErrorMessage (TypeConflictsWithClass nm) =
497− line $ "The type " ++ runProperName nm ++ " conflicts with a type class declaration of the same name."
497+ line $ "Type " ++ runProperName nm ++ " conflicts with a type class declaration with the same name."
498 renderSimpleErrorMessage (CtorConflictsWithClass nm) =
498 renderSimpleErrorMessage (CtorConflictsWithClass nm) =
499− line $ "The data constructor " ++ runProperName nm ++ " conflicts with a type class declaration of the same name."
499+ line $ "Data constructor " ++ runProperName nm ++ " conflicts with a type class declaration with the same name."
500 renderSimpleErrorMessage (ClassConflictsWithType nm) =
500 renderSimpleErrorMessage (ClassConflictsWithType nm) =
501− line $ "The type class " ++ runProperName nm ++ " conflicts with a type declaration of the same name."
501+ line $ "Type class " ++ runProperName nm ++ " conflicts with a type declaration with the same name."
502 renderSimpleErrorMessage (ClassConflictsWithCtor nm) =
502 renderSimpleErrorMessage (ClassConflictsWithCtor nm) =
503− line $ "The type class " ++ runProperName nm ++ " conflicts with a data constructor declaration of the same name."
503+ line $ "Type class " ++ runProperName nm ++ " conflicts with a data constructor declaration with the same name."
504 renderSimpleErrorMessage (DuplicateModuleName mn) =
504 renderSimpleErrorMessage (DuplicateModuleName mn) =
505− line $ "The module " ++ runModuleName mn ++ " has been defined multiple times."
505+ line $ "Module " ++ runModuleName mn ++ " has been defined multiple times."
506 renderSimpleErrorMessage (DuplicateClassExport nm) =
506 renderSimpleErrorMessage (DuplicateClassExport nm) =
507 line $ "Duplicate export declaration for type class " ++ runProperName nm
507 line $ "Duplicate export declaration for type class " ++ runProperName nm
508 renderSimpleErrorMessage (DuplicateValueExport nm) =
508 renderSimpleErrorMessage (DuplicateValueExport nm) =
@@ -510,20 +510,22 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
510 renderSimpleErrorMessage (CycleInDeclaration nm) =
510 renderSimpleErrorMessage (CycleInDeclaration nm) =
511 line $ "The value of " ++ showIdent nm ++ " is undefined here, so this reference is not allowed."
511 line $ "The value of " ++ showIdent nm ++ " is undefined here, so this reference is not allowed."
512 renderSimpleErrorMessage (CycleInModules mns) =
512 renderSimpleErrorMessage (CycleInModules mns) =
513− line $ "There is a cycle in the module dependencies: " ++ intercalate ", " (map runModuleName mns)
513+ paras [ line $ "There is a cycle in module dependencies in these modules: "
514+ , indent $ paras (map (line . runModuleName) mns)
514 renderSimpleErrorMessage (CycleInTypeSynonym name) =
516 renderSimpleErrorMessage (CycleInTypeSynonym name) =
515 paras [ line $ case name of
517 paras [ line $ case name of
516− Just pn -> "A cycle appears in the definition of the type synonym " ++ runProperName pn
518+ Just pn -> "A cycle appears in the definition of type synonym " ++ runProperName pn
517 Nothing -> "A cycle appears in a set of type synonym definitions."
519 Nothing -> "A cycle appears in a set of type synonym definitions."
518 , line "Cycles are disallowed because they can lead to loops in the type checker."
520 , line "Cycles are disallowed because they can lead to loops in the type checker."
519 , line "Consider using a 'newtype' instead."
521 , line "Consider using a 'newtype' instead."
521 renderSimpleErrorMessage (NameIsUndefined ident) =
523 renderSimpleErrorMessage (NameIsUndefined ident) =
522− line $ "The value " ++ showIdent ident ++ " is undefined."
524+ line $ "Value " ++ showIdent ident ++ " is undefined."
523 renderSimpleErrorMessage (UndefinedTypeVariable name) =
525 renderSimpleErrorMessage (UndefinedTypeVariable name) =
524− line $ "The type variable " ++ runProperName name ++ " is undefined."
526+ line $ "Type variable " ++ runProperName name ++ " is undefined."
525 renderSimpleErrorMessage (PartiallyAppliedSynonym name) =
527 renderSimpleErrorMessage (PartiallyAppliedSynonym name) =
526− paras [ line $ "The type synonym " ++ showQualified runProperName name ++ " is partially applied."
528+ paras [ line $ "Type synonym " ++ showQualified runProperName name ++ " is partially applied."
527 , line "Type synonyms must be applied to all of their type arguments."
529 , line "Type synonyms must be applied to all of their type arguments."
529 renderSimpleErrorMessage (EscapedSkolem binding) =
531 renderSimpleErrorMessage (EscapedSkolem binding) =
@@ -544,7 +546,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
544 , indent $ line $ prettyPrintKind k2
546 , indent $ line $ prettyPrintKind k2
546 renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) =
548 renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) =
547− paras [ line "Could not match the constrained type"
549+ paras [ line "Could not match constrained type"
548 , indent $ typeAsBox t1
550 , indent $ typeAsBox t1
549 , line "with type"
551 , line "with type"
550 , indent $ typeAsBox t2
552 , indent $ typeAsBox t2
@@ -567,7 +569,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
569 renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) =
571 renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) =
570− paras [ line "The type class instance for"
572+ paras [ line "Type class instance for"
571 , indent $ Box.hsep 1 Box.left [ line (showQualified runProperName nm)
573 , indent $ Box.hsep 1 Box.left [ line (showQualified runProperName nm)
572 , Box.vcat Box.left (map typeAtomAsBox ts)
574 , Box.vcat Box.left (map typeAtomAsBox ts)
@@ -582,12 +584,12 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
582 renderSimpleErrorMessage (CannotFindDerivingType nm) =
584 renderSimpleErrorMessage (CannotFindDerivingType nm) =
583 line $ "Cannot derive a type class instance, because the type declaration for " ++ runProperName nm ++ " could not be found."
585 line $ "Cannot derive a type class instance, because the type declaration for " ++ runProperName nm ++ " could not be found."
584 renderSimpleErrorMessage (DuplicateLabel l expr) =
586 renderSimpleErrorMessage (DuplicateLabel l expr) =
585− paras $ [ line $ "The label " ++ show l ++ " appears more than once in a row type." ]
587+ paras $ [ line $ "Label " ++ show l ++ " appears more than once in a row type." ]
586 <> foldMap (\expr' -> [ line "Relevant expression: "
588 <> foldMap (\expr' -> [ line "Relevant expression: "
587 , indent $ prettyPrintValue expr'
589 , indent $ prettyPrintValue expr'
589 renderSimpleErrorMessage (DuplicateTypeArgument name) =
591 renderSimpleErrorMessage (DuplicateTypeArgument name) =
590− line $ "The type argument " ++ show name ++ " appears more than once."
592+ line $ "Type argument " ++ show name ++ " appears more than once."
591 renderSimpleErrorMessage (DuplicateValueDeclaration nm) =
593 renderSimpleErrorMessage (DuplicateValueDeclaration nm) =
592 line $ "Multiple value declarations exist for " ++ showIdent nm ++ "."
594 line $ "Multiple value declarations exist for " ++ showIdent nm ++ "."
593 renderSimpleErrorMessage (ArgListLengthsDiffer ident) =
595 renderSimpleErrorMessage (ArgListLengthsDiffer ident) =
@@ -595,7 +597,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
595 renderSimpleErrorMessage (OverlappingArgNames ident) =
597 renderSimpleErrorMessage (OverlappingArgNames ident) =
596 line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . showIdent) ident
598 line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . showIdent) ident
597 renderSimpleErrorMessage (MissingClassMember ident) =
599 renderSimpleErrorMessage (MissingClassMember ident) =
598− line $ "The type class member " ++ showIdent ident ++ " has not been implemented."
600+ line $ "Type class member " ++ showIdent ident ++ " has not been implemented."
599 renderSimpleErrorMessage (ExtraneousClassMember ident className) =
601 renderSimpleErrorMessage (ExtraneousClassMember ident className) =
600 line $ showIdent ident ++ " is not a member of type class " ++ showQualified runProperName className
602 line $ showIdent ident ++ " is not a member of type class " ++ showQualified runProperName className
601 renderSimpleErrorMessage (ExpectedType ty kind) =
603 renderSimpleErrorMessage (ExpectedType ty kind) =
@@ -607,17 +609,17 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
607 , line "instead."
609 , line "instead."
609 renderSimpleErrorMessage (IncorrectConstructorArity nm) =
611 renderSimpleErrorMessage (IncorrectConstructorArity nm) =
610− line $ "The data constructor " ++ showQualified runProperName nm ++ " was given the wrong number of arguments in a case expression."
612+ line $ "Data constructor " ++ showQualified runProperName nm ++ " was given the wrong number of arguments in a case expression."
611 renderSimpleErrorMessage (ExprDoesNotHaveType expr ty) =
613 renderSimpleErrorMessage (ExprDoesNotHaveType expr ty) =
612− paras [ line "The expression"
614+ paras [ line "Expression"
613 , indent $ prettyPrintValue expr
615 , indent $ prettyPrintValue expr
614 , line "does not have type"
616 , line "does not have type"
615 , indent $ typeAsBox ty
617 , indent $ typeAsBox ty
617 renderSimpleErrorMessage (PropertyIsMissing prop row) =
619 renderSimpleErrorMessage (PropertyIsMissing prop row) =
618− paras [ line "The row type"
620+ paras [ line "Row type"
619 , indent $ prettyPrintRowWith '(' ')' row
621 , indent $ prettyPrintRowWith '(' ')' row
620− , line $ "lacks the required label " ++ show prop
622+ , line $ "lacks required label " ++ show prop
622 renderSimpleErrorMessage (CannotApplyFunction fn arg) =
624 renderSimpleErrorMessage (CannotApplyFunction fn arg) =
623 paras [ line "A function of type"
625 paras [ line "A function of type"
@@ -628,7 +630,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
628 renderSimpleErrorMessage TypeSynonymInstance =
630 renderSimpleErrorMessage TypeSynonymInstance =
629 line "Type class instances for type synonyms are disallowed."
631 line "Type class instances for type synonyms are disallowed."
630 renderSimpleErrorMessage (OrphanInstance nm cnm ts) =
632 renderSimpleErrorMessage (OrphanInstance nm cnm ts) =
631− paras [ line $ "The type class instance " ++ showIdent nm ++ " for "
633+ paras [ line $ "Type class instance " ++ showIdent nm ++ " for "
632 , indent $ Box.hsep 1 Box.left [ line (showQualified runProperName cnm)
634 , indent $ Box.hsep 1 Box.left [ line (showQualified runProperName cnm)
633 , Box.vcat Box.left (map typeAtomAsBox ts)
635 , Box.vcat Box.left (map typeAtomAsBox ts)
@@ -637,11 +639,11 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
637 , line "Consider moving the instance, if possible, or using a newtype wrapper."
639 , line "Consider moving the instance, if possible, or using a newtype wrapper."
639 renderSimpleErrorMessage (InvalidNewtype name) =
641 renderSimpleErrorMessage (InvalidNewtype name) =
640− paras [ line $ "The newtype " ++ runProperName name ++ " is invalid."
642+ paras [ line $ "Newtype " ++ runProperName name ++ " is invalid."
641 , line "Newtypes must define a single constructor with a single argument."
643 , line "Newtypes must define a single constructor with a single argument."
643 renderSimpleErrorMessage (InvalidInstanceHead ty) =
645 renderSimpleErrorMessage (InvalidInstanceHead ty) =
644− paras [ line "Type class instance head is invalid due to the use of the type"
646+ paras [ line "Type class instance head is invalid due to use of type"
645 , indent $ typeAsBox ty
647 , indent $ typeAsBox ty
646 , line "All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form."
648 , line "All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form."
@@ -649,13 +651,13 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
649 paras $ line ("An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
651 paras $ line ("An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
650 : map (line . prettyPrintExport) ys
652 : map (line . prettyPrintExport) ys
651 renderSimpleErrorMessage (ShadowedName nm) =
653 renderSimpleErrorMessage (ShadowedName nm) =
652− line $ "The name '" ++ showIdent nm ++ "' was shadowed."
654+ line $ "Name '" ++ showIdent nm ++ "' was shadowed."
653 renderSimpleErrorMessage (ShadowedTypeVar tv) =
655 renderSimpleErrorMessage (ShadowedTypeVar tv) =
654− line $ "The type variable '" ++ tv ++ "' was shadowed."
656+ line $ "Type variable '" ++ tv ++ "' was shadowed."
655 renderSimpleErrorMessage (UnusedTypeVar tv) =
657 renderSimpleErrorMessage (UnusedTypeVar tv) =
656− line $ "The type variable '" ++ tv ++ "' was declared but not used."
658+ line $ "Type variable '" ++ tv ++ "' was declared but not used."
657 renderSimpleErrorMessage (ClassOperator className opName) =
659 renderSimpleErrorMessage (ClassOperator className opName) =
658− paras [ line $ "The type class '" ++ runProperName className ++ "' declares operator " ++ showIdent opName ++ "."
660+ paras [ line $ "Type class '" ++ runProperName className ++ "' declares operator " ++ showIdent opName ++ "."
659 , line "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
661 , line "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
660 , indent . line $ showIdent opName ++ " = someMember"
662 , indent . line $ showIdent opName ++ " = someMember"
@@ -666,7 +668,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
666 , line $ "An attempt was made to hide the import of " ++ runModuleName name
668 , line $ "An attempt was made to hide the import of " ++ runModuleName name
668 renderSimpleErrorMessage (WildcardInferredType ty) =
670 renderSimpleErrorMessage (WildcardInferredType ty) =
669− paras [ line "The wildcard type definition has the inferred type "
671+ paras [ line "Wildcard type definition has the inferred type "
670 , indent $ typeAsBox ty
672 , indent $ typeAsBox ty
672 renderSimpleErrorMessage (MissingTypeDeclaration ident) =
674 renderSimpleErrorMessage (MissingTypeDeclaration ident) =
@@ -695,9 +697,9 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
695 renderHint (NotYetDefined names) =
697 renderHint (NotYetDefined names) =
696 line $ "The following are not yet defined here: " ++ intercalate ", " (map showIdent names) ++ ":"
698 line $ "The following are not yet defined here: " ++ intercalate ", " (map showIdent names) ++ ":"
697 renderHint (ErrorUnifyingTypes t1 t2) =
699 renderHint (ErrorUnifyingTypes t1 t2) =
698− paras [ lineWithLevel "while trying to match the type "
700+ paras [ lineWithLevel "while trying to match type "
699 , indent $ typeAsBox t1
701 , indent $ typeAsBox t1
700− , line "with the type"
702+ , line "with type"
701 , indent $ typeAsBox t2
703 , indent $ typeAsBox t2
703 renderHint (ErrorInExpression expr) =
705 renderHint (ErrorInExpression expr) =
@@ -708,9 +710,9 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
708 paras [ lineWithLevel $ "in module " ++ runModuleName mn ++ ":"
710 paras [ lineWithLevel $ "in module " ++ runModuleName mn ++ ":"
710 renderHint (ErrorInSubsumption t1 t2) =
712 renderHint (ErrorInSubsumption t1 t2) =
711− paras [ lineWithLevel "checking that the type"
713+ paras [ lineWithLevel "checking that type"
712 , indent $ typeAsBox t1
714 , indent $ typeAsBox t1
713− , line "is at least as general as the type"
715+ , line "is at least as general as type"
714 , indent $ typeAsBox t2
716 , indent $ typeAsBox t2
716 renderHint (ErrorInInstance nm ts) =
718 renderHint (ErrorInInstance nm ts) =
@@ -720,17 +722,17 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
722 renderHint (ErrorCheckingKind ty) =
724 renderHint (ErrorCheckingKind ty) =
723− paras [ lineWithLevel "checking the kind of the type"
725+ paras [ lineWithLevel "checking kind of type"
724 , indent $ typeAsBox ty
726 , indent $ typeAsBox ty
726 renderHint (ErrorInferringType expr) =
728 renderHint (ErrorInferringType expr) =
727− paras [ lineWithLevel "inferring the type of the expression"
729+ paras [ lineWithLevel "inferring type of expression"
728 , indent $ prettyPrintValue expr
730 , indent $ prettyPrintValue expr
730 renderHint (ErrorCheckingType expr ty) =
732 renderHint (ErrorCheckingType expr ty) =
731− paras [ lineWithLevel "checking that the expression"
733+ paras [ lineWithLevel "checking that expression"
732 , indent $ prettyPrintValue expr
734 , indent $ prettyPrintValue expr
733− , line "has the type"
735+ , line "has type"
734 , indent $ typeAsBox ty
736 , indent $ typeAsBox ty
736 renderHint (ErrorInApplication f t a) =
738 renderHint (ErrorInApplication f t a) =
@@ -738,7 +740,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage . positionHintsFir
738 , indent $ prettyPrintValue f
740 , indent $ prettyPrintValue f
739 , line "of type"
741 , line "of type"
740 , indent $ typeAsBox t
742 , indent $ typeAsBox t
741− , line "to the argument"
743+ , line "to argument"
742 , indent $ prettyPrintValue a
744 , indent $ prettyPrintValue a
744 renderHint (ErrorInDataConstructor nm) =
746 renderHint (ErrorInDataConstructor nm) =