@@ -476,9 +476,9 @@ problemToHint problem =
476476 T.Infinite -> []
477477 T.Error -> []
478478 T.FlexVar _ -> []
479− T.FlexSuper s _ -> badDoubleFlexSuper super s
479+ T.FlexSuper s _ -> badFlexFlexSuper super s
480480 T.RigidVar y -> badRigidVar y (toASuperThing super)
481− T.RigidSuper s _ -> error "TODO"
481+ T.RigidSuper s _ -> badRigidSuper s (toASuperThing super)
482482 T.Type _ _ _ -> badFlexSuper super
483483 T.Record _ _ -> badFlexSuper super
484484 T.Unit -> badFlexSuper super
@@ -506,7 +506,7 @@ problemToHint problem =
506506 T.Infinite -> []
507507 T.Error -> []
508508 T.FlexVar _ -> []
509− T.FlexSuper s _ -> error "TODO"
509+ T.FlexSuper s _ -> badRigidSuper super (toASuperThing s)
510510 T.RigidVar y -> badDoubleRigid x y
511511 T.RigidSuper _ y -> badDoubleRigid x y
512512 T.Type _ n _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
@@ -516,15 +516,8 @@ problemToHint problem =
516516 T.Alias _ n _ _ -> badRigidSuper super ("a `" ++ N.toString n ++ "` value")
517517
518518
519−badFlexSuper :: T.Super -> [H.Doc]
520−badFlexSuper super =
521− case super of
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." ]
525− T.Number ->
526− [ H.toFancyHint ["Only",H.green "Int","and",H.green "Float","values","work","as","numbers."]
527− ]
519+
520+-- BAD RIGID HINTS
528521
529522
530523badRigidVar :: N.Name -> String -> [H.Doc]
@@ -538,6 +531,17 @@ badRigidVar name aThing =
538531 ]
539532
540533
534+badDoubleRigid :: N.Name -> N.Name -> [H.Doc]
535+badDoubleRigid x y =
536+ [ H.toSimpleHint $
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!"
542+ ]
543+
544+
541545toASuperThing :: T.Super -> String
542546toASuperThing super =
543547 case super of
@@ -547,20 +551,19 @@ toASuperThing super =
547551 T.Appendable -> "an `appendable` value"
548552
549553
550−badDoubleFlexSuper :: T.Super -> T.Super -> [H.Doc]
551−badDoubleFlexSuper s1 s2 =
552− let
553− likeThis super =
554− case super of
555− T.Number -> "a number"
556− T.Comparable -> "comparable"
557− T.CompAppend -> "a compappend"
558− T.Appendable -> "appendable"
559− in
560− [ H.toSimpleHint $
561− "There are no values in Elm that are both"
562− ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
563− ]
554+
555+-- BAD SUPER HINTS
556+
557+
558+badFlexSuper :: T.Super -> [H.Doc]
559+badFlexSuper super =
560+ case super of
561+ T.Comparable -> [ H.toSimpleHint "Only ints, floats, chars, strings, lists, and tuples are comparable." ]
562+ T.Appendable -> [ H.toSimpleHint "Only strings and lists are appendable." ]
563+ T.CompAppend -> [ H.toSimpleHint "Only strings and lists are both comparable and appendable." ]
564+ T.Number ->
565+ [ H.toFancyHint ["Only",H.green "Int","and",H.green "Float","values","work","as","numbers."]
566+ ]
564567
565568
566569badRigidSuper :: T.Super -> String -> [H.Doc]
@@ -582,15 +585,20 @@ badRigidSuper super aThing =
582585 ]
583586
584587
585−badDoubleRigid :: N.Name -> N.Name -> [H.Doc]
586−badDoubleRigid x y =
587− [ H.toSimpleHint $
588− "Your type annotation uses `" ++ N.toString x ++ "` and `" ++ N.toString y ++
589− "` as separate type variables. Your code seems to be saying they are the\
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!"
593− ]
588+badFlexFlexSuper :: T.Super -> T.Super -> [H.Doc]
589+badFlexFlexSuper s1 s2 =
590+ let
591+ likeThis super =
592+ case super of
593+ T.Number -> "a number"
594+ T.Comparable -> "comparable"
595+ T.CompAppend -> "a compappend"
596+ T.Appendable -> "appendable"
597+ in
598+ [ H.toSimpleHint $
599+ "There are no values in Elm that are both"
600+ ++ likeThis s1 ++ " and " ++ likeThis s2 ++ "."
601+ ]
594602
595603
596604