Commit bf83435b authored by Ben Gamari's avatar Ben Gamari 🐢

typecheck: Clarify errors mentioned in #14385

parent 61f1b46e
......@@ -2796,7 +2796,7 @@ checkFamFlag tc_name
; checkTc idx_tys err_msg }
where
err_msg = hang (text "Illegal family declaration for" <+> quotes (ppr tc_name))
2 (text "Use TypeFamilies to allow indexed type families")
2 (text "Enable TypeFamilies to allow indexed type families")
{- Note [Class method constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -3163,20 +3163,20 @@ classArityErr n cls
where
mkErr howMany allowWhat =
vcat [text (howMany ++ " parameters for class") <+> quotes (ppr cls),
parens (text ("Use MultiParamTypeClasses to allow "
parens (text ("Enable MultiParamTypeClasses to allow "
++ allowWhat ++ " classes"))]
classFunDepsErr :: Class -> SDoc
classFunDepsErr cls
= vcat [text "Fundeps in class" <+> quotes (ppr cls),
parens (text "Use FunctionalDependencies to allow fundeps")]
parens (text "Enable FunctionalDependencies to allow fundeps")]
badMethPred :: Id -> TcPredType -> SDoc
badMethPred sel_id pred
= vcat [ hang (text "Constraint" <+> quotes (ppr pred)
<+> text "in the type of" <+> quotes (ppr sel_id))
2 (text "constrains only the class type variables")
, text "Use ConstrainedClassMethods to allow it" ]
, text "Enable ConstrainedClassMethods to allow it" ]
noClassTyVarErr :: Class -> TyCon -> SDoc
noClassTyVarErr clas fam_tc
......@@ -3235,14 +3235,14 @@ badDataConTyCon data_con res_ty_tmpl actual_res_ty
badGadtDecl :: Name -> SDoc
badGadtDecl tc_name
= vcat [ text "Illegal generalised algebraic data declaration for" <+> quotes (ppr tc_name)
, nest 2 (parens $ text "Use GADTs to allow GADTs") ]
, nest 2 (parens $ text "Enable the GADTs extension to allow this") ]
badExistential :: DataCon -> SDoc
badExistential con
= hang (text "Data constructor" <+> quotes (ppr con) <+>
text "has existential type variables, a context, or a specialised result type")
2 (vcat [ ppr con <+> dcolon <+> ppr (dataConUserType con)
, parens $ text "Use ExistentialQuantification or GADTs to allow this" ])
, parens $ text "Enable ExistentialQuantification or GADTs to allow this" ])
badGADT :: DataCon -> [EqSpec] -> SDoc
badGADT con eq_specs
......
......@@ -2,6 +2,6 @@
gadtSyntaxFail001.hs:8:5: error:
• Data constructor ‘C2’ has existential type variables, a context, or a specialised result type
C2 :: forall a. a -> Char -> Foo a Int
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C2’
In the data type declaration for ‘Foo’
......@@ -2,6 +2,6 @@
gadtSyntaxFail002.hs:8:5: error:
• Data constructor ‘C2’ has existential type variables, a context, or a specialised result type
C2 :: forall a. a -> Char -> Foo a a
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C2’
In the data type declaration for ‘Foo’
......@@ -2,6 +2,6 @@
gadtSyntaxFail003.hs:7:5: error:
• Data constructor ‘C1’ has existential type variables, a context, or a specialised result type
C1 :: forall a c b. a -> Int -> c -> Foo b a
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C1’
In the data type declaration for ‘Foo’
<interactive>:4:1: error:
• Illegal generalised algebraic data declaration for ‘T’
(Use GADTs to allow GADTs)
(Enable the GADTs extension to allow this)
• In the data declaration for ‘T’
ghci057.hs:3:3: error:
• Data constructor ‘C’ has existential type variables, a context, or a specialised result type
C :: T Int
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C’
In the data type declaration for ‘T’
ghci057.hs:3:3: error:
• Data constructor ‘C’ has existential type variables, a context, or a specialised result type
C :: T Int
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C’
In the data type declaration for ‘T’
<interactive>:4:1: error:
• Illegal generalised algebraic data declaration for ‘T’
(Use GADTs to allow GADTs)
(Enable the GADTs extension to allow this)
• In the data declaration for ‘T’
ghci057.hs:3:3: error:
• Data constructor ‘C’ has existential type variables, a context, or a specialised result type
C :: T Int
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C’
In the data type declaration for ‘T’
ghci057.hs:3:3: error:
• Data constructor ‘C’ has existential type variables, a context, or a specialised result type
C :: T Int
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘C’
In the data type declaration for ‘T’
......@@ -2,6 +2,6 @@
mod39.hs:3:17: error:
• Constraint ‘Eq a’ in the type of ‘f’
constrains only the class type variables
Use ConstrainedClassMethods to allow it
Enable ConstrainedClassMethods to allow it
• When checking the class method: f :: forall a. (C a, Eq a) => a
In the class declaration for ‘C’
readFail037.hs:4:1:
Too many parameters for class ‘Foo’
(Use MultiParamTypeClasses to allow multi-parameter classes)
In the class declaration for ‘Foo’
readFail037.hs:4:1: error:
Too many parameters for class ‘Foo’
(Enable MultiParamTypeClasses to allow multi-parameter classes)
In the class declaration for ‘Foo’
readFail041.hs:6:1:
Fundeps in class ‘Foo’
(Use FunctionalDependencies to allow fundeps)
In the class declaration for ‘Foo’
readFail041.hs:6:1: error:
Fundeps in class ‘Foo’
(Enable FunctionalDependencies to allow fundeps)
In the class declaration for ‘Foo’
......@@ -7,6 +7,6 @@ T12083a.hs:5:1: error:
T12083a.hs:9:26: error:
• Data constructor ‘ExistentiallyLost’ has existential type variables, a context, or a specialised result type
ExistentiallyLost :: forall u. TC u => u -> ExistentiallyLost
(Use ExistentialQuantification or GADTs to allow this)
(Enable ExistentialQuantification or GADTs to allow this)
• In the definition of data constructor ‘ExistentiallyLost’
In the data type declaration for ‘ExistentiallyLost’
TcNoNullaryTC.hs:3:1:
No parameters for class ‘A’
(Use MultiParamTypeClasses to allow no-parameter classes)
In the class declaration for ‘A’
TcNoNullaryTC.hs:3:1: error:
No parameters for class ‘A’
(Enable MultiParamTypeClasses to allow no-parameter classes)
In the class declaration for ‘A’
......@@ -2,7 +2,7 @@
tcfail150.hs:6:3: error:
• Constraint ‘Eq a’ in the type of ‘op’
constrains only the class type variables
Use ConstrainedClassMethods to allow it
Enable ConstrainedClassMethods to allow it
• When checking the class method:
op :: forall a. (Foo a, Eq a) => a -> a
In the class declaration for ‘Foo’
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment