@@ -476,9 +476,9 @@ problemToHint problem =
476 T.Infinite -> []
476 T.Infinite -> []
477 T.Error -> []
477 T.Error -> []
478 T.FlexVar _ -> []
478 T.FlexVar _ -> []
479− T.FlexSuper s _ -> badDoubleFlexSuper super s
479+ T.FlexSuper s _ -> badFlexFlexSuper super s
480 T.RigidVar y -> badRigidVar y (toASuperThing super)
480 T.RigidVar y -> badRigidVar y (toASuperThing super)
481− T.RigidSuper s _ -> error "TODO"
481+ T.RigidSuper s _ -> badRigidSuper s (toASuperThing super)
482 T.Type _ _ _ -> badFlexSuper super
482 T.Type _ _ _ -> badFlexSuper super
483 T.Record _ _ -> badFlexSuper super
483 T.Record _ _ -> badFlexSuper super
484 T.Unit -> badFlexSuper super
484 T.Unit -> badFlexSuper super
@@ -506,7 +506,7 @@ problemToHint problem =
506 T.Infinite -> []
506 T.Infinite -> []
507 T.Error -> []
507 T.Error -> []
508 T.FlexVar _ -> []
508 T.FlexVar _ -> []
509− T.FlexSuper s _ -> error "TODO"
509+ T.FlexSuper s _ -> badRigidSuper super (toASuperThing s)
510 T.RigidVar y -> badDoubleRigid x y
510 T.RigidVar y -> badDoubleRigid x y
511 T.RigidSuper _ y -> badDoubleRigid x y
511 T.RigidSuper _ y -> badDoubleRigid x y
512 T.Type _ n _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
512 T.Type _ n _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
@@ -516,15 +516,8 @@ problemToHint problem =
516 T.Alias _ n _ _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
516 T.Alias _ n _ _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
519−badFlexSuper :: T.Super -> [H.Doc]
519+
520−badFlexSuper super =
520+-- BAD RIGID HINTS
522− T.Comparable -> [ H.toSimpleHint "Only ints, floats, chars, strings, lists, and tuples are comparable." ]
523− T.Appendable -> [ H.toSimpleHint "Only strings and lists are appendable." ]
524− T.CompAppend -> [ H.toSimpleHint "Only strings and lists are both comparable and appendable." ]
526− [ H.toFancyHint ["Only",H.green "Int","and",H.green "Float","values","work","as","numbers."]
530badRigidVar :: N.Name -> String -> [H.Doc]
523badRigidVar :: N.Name -> String -> [H.Doc]
@@ -538,6 +531,17 @@ badRigidVar name aThing =
534+badDoubleRigid :: N.Name -> N.Name -> [H.Doc]
537+ "Your type annotation uses `" ++ N.toString x ++ "` and `" ++ N.toString y ++
538+ "` as separate type variables. Your code seems to be saying they are the\
539+ \ same though! Maybe they should be the same in your type annotation?\
540+ \ Maybe your code uses them in a weird way?"
541+ , H.reflowLink "Read" "type-annotations" "for more advice!"
541toASuperThing :: T.Super -> String
545toASuperThing :: T.Super -> String
542toASuperThing super =
546toASuperThing super =
543 case super of
547 case super of
@@ -547,20 +551,19 @@ toASuperThing super =
547 T.Appendable -> "an `appendable` value"
551 T.Appendable -> "an `appendable` value"
550−badDoubleFlexSuper :: T.Super -> T.Super -> [H.Doc]
554+
551−badDoubleFlexSuper s1 s2 =
555+-- BAD SUPER HINTS
553− likeThis super =
557+
558+badFlexSuper :: T.Super -> [H.Doc]
554− case super of
560+ case super of
555− T.Number -> "a number"
556− T.Comparable -> "comparable"
561+ T.Comparable -> [ H.toSimpleHint "Only ints, floats, chars, strings, lists, and tuples are comparable." ]
557− T.CompAppend -> "a compappend"
562+ T.Appendable -> [ H.toSimpleHint "Only strings and lists are appendable." ]
558− T.Appendable -> "appendable"
563+ T.CompAppend -> [ H.toSimpleHint "Only strings and lists are both comparable and appendable." ]
560− [ H.toSimpleHint $
565+ [ H.toFancyHint ["Only",H.green "Int","and",H.green "Float","values","work","as","numbers."]
561− "There are no values in Elm that are both"
562− ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
566badRigidSuper :: T.Super -> String -> [H.Doc]
569badRigidSuper :: T.Super -> String -> [H.Doc]
@@ -582,15 +585,20 @@ badRigidSuper super aThing =
585−badDoubleRigid :: N.Name -> N.Name -> [H.Doc]
588+badFlexFlexSuper :: T.Super -> T.Super -> [H.Doc]
586−badDoubleRigid x y =
589+badFlexFlexSuper s1 s2 =
593+ T.Number -> "a number"
594+ T.Comparable -> "comparable"
595+ T.CompAppend -> "a compappend"
596+ T.Appendable -> "appendable"
587− [ H.toSimpleHint $
598+ [ H.toSimpleHint $
588− "Your type annotation uses `" ++ N.toString x ++ "` and `" ++ N.toString y ++
599+ "There are no values in Elm that are both"
589− "` as separate type variables. Your code seems to be saying they are the\
600+ ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
590− \ same though! Maybe they should be the same in your type annotation?\
591− \ Maybe your code uses them in a weird way?"
592− , H.reflowLink "Read" "type-annotations" "for more advice!"