@@ -140,6 +140,8 @@ data SimpleErrorMessage
140140 | InvalidInstanceHead Type
141141 | TransitiveExportError DeclarationRef [DeclarationRef]
142142 | ShadowedName Ident
143+ | ShadowedTypeVar String
144+ | UnusedTypeVar String
143145 | WildcardInferredType Type
144146 | NotExhaustivePattern [[Binder]] Bool
145147 | OverlappingPattern [[Binder]] Bool
@@ -168,6 +170,7 @@ data ErrorMessage
168170 | ErrorInDataBindingGroup ErrorMessage
169171 | ErrorInTypeSynonym ProperName ErrorMessage
170172 | ErrorInValueDeclaration Ident ErrorMessage
173+ | ErrorInTypeDeclaration Ident ErrorMessage
171174 | ErrorInForeignImport Ident ErrorMessage
172175 | PositionedError SourceSpan ErrorMessage
173176 | SimpleErrorWrapper SimpleErrorMessage
@@ -266,6 +269,8 @@ errorCode em = case unwrapErrorMessage em of
266269 InvalidInstanceHead{} -> "InvalidInstanceHead"
267270 TransitiveExportError{} -> "TransitiveExportError"
268271 ShadowedName{} -> "ShadowedName"
272+ ShadowedTypeVar{} -> "ShadowedTypeVar"
273+ UnusedTypeVar{} -> "UnusedTypeVar"
269274 WildcardInferredType{} -> "WildcardInferredType"
270275 NotExhaustivePattern{} -> "NotExhaustivePattern"
271276 OverlappingPattern{} -> "OverlappingPattern"
@@ -336,6 +341,7 @@ unwrapErrorMessage em = case em of
336341 (ErrorInTypeConstructor _ err) -> unwrapErrorMessage err
337342 (ErrorInTypeSynonym _ err) -> unwrapErrorMessage err
338343 (ErrorInValueDeclaration _ err) -> unwrapErrorMessage err
344+ (ErrorInTypeDeclaration _ err) -> unwrapErrorMessage err
339345 (ErrorInferringType _ err) -> unwrapErrorMessage err
340346 (ErrorUnifyingTypes _ _ err) -> unwrapErrorMessage err
341347 (NotYetDefined _ err) -> unwrapErrorMessage err
@@ -382,6 +388,7 @@ onTypesInErrorMessageM f = g
382388 g (ErrorInDataBindingGroup e) = ErrorInDataBindingGroup <$> (g e)
383389 g (ErrorInTypeSynonym x e) = ErrorInTypeSynonym x <$> (g e)
384390 g (ErrorInValueDeclaration x e) = ErrorInValueDeclaration x <$> (g e)
391+ g (ErrorInTypeDeclaration x e) = ErrorInTypeDeclaration x <$> (g e)
385392 g (ErrorInForeignImport x e) = ErrorInForeignImport x <$> (g e)
386393 g (PositionedError x e) = PositionedError x <$> (g e)
387394 g (SimpleErrorWrapper sem) = SimpleErrorWrapper <$> gSimple sem
@@ -628,7 +635,11 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
628635 paras $ line ("An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
629636 : map (line . prettyPrintExport) ys
630637 goSimple (ShadowedName nm) =
631− line $ "Name '" ++ showIdent nm ++ "' was shadowed."
638+ line $ "Name '" ++ showIdent nm ++ "' was shadowed"
639+ goSimple (ShadowedTypeVar tv) =
640+ line $ "Type variable '" ++ tv ++ "' was shadowed"
641+ goSimple (UnusedTypeVar tv) =
642+ line $ "Type variable '" ++ tv ++ "' was declared but not used"
632643 goSimple (ClassOperator className opName) =
633644 paras [ line $ "Class '" ++ runProperName className ++ "' declares operator " ++ showIdent opName ++ "."
634645 , indent $ line "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
@@ -732,6 +743,10 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
732743 paras [ lineWithLevel $ "in value declaration " ++ showIdent n ++ ":"
733744 , go err
734745 ]
746+ go (ErrorInTypeDeclaration n err) =
747+ paras [ lineWithLevel $ "in type declaration for " ++ showIdent n ++ ":"
748+ , go err
749+ ]
735750 go (ErrorInForeignImport nm err) =
736751 paras [ lineWithLevel $ "in foreign import " ++ showIdent nm ++ ":"
737752 , go err
@@ -797,6 +812,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
797812 unwrap pos (ErrorInDataBindingGroup err) = ErrorInDataBindingGroup (unwrap pos err)
798813 unwrap pos (ErrorInTypeSynonym nm err) = ErrorInTypeSynonym nm (unwrap pos err)
799814 unwrap pos (ErrorInValueDeclaration nm err) = ErrorInValueDeclaration nm (unwrap pos err)
815+ unwrap pos (ErrorInTypeDeclaration nm err) = ErrorInTypeDeclaration nm (unwrap pos err)
800816 unwrap pos (ErrorInForeignImport nm err) = ErrorInForeignImport nm (unwrap pos err)
801817 unwrap pos (NotYetDefined ns err) = NotYetDefined ns (unwrap pos err)
802818 unwrap _ (PositionedError pos err) = unwrap (Just pos) err