@@ -438,20 +438,20 @@ problemToHint problem =
438438 T. MissingArgs _ -> []
439439 T. ReturnMismatch -> []
440440
441- T. BadFlexSuper super _ tipe ->
441+ T. BadFlexSuper direction super _ tipe ->
442442 case tipe of
443- T. Lambda _ _ _ -> badFlexSuper super tipe
443+ T. Lambda _ _ _ -> badFlexSuper direction super tipe
444444 T. Infinite -> []
445445 T. Error -> []
446446 T. FlexVar _ -> []
447447 T. FlexSuper s _ -> badFlexFlexSuper super s
448448 T. RigidVar y -> badRigidVar y (toASuperThing super)
449449 T. RigidSuper s _ -> badRigidSuper s (toASuperThing super)
450- T. Type _ _ _ -> badFlexSuper super tipe
451- T. Record _ _ -> badFlexSuper super tipe
452- T. Unit -> badFlexSuper super tipe
453- T. Tuple _ _ _ -> badFlexSuper super tipe
454- T. Alias _ _ _ _ -> badFlexSuper super tipe
450+ T. Type _ _ _ -> badFlexSuper direction super tipe
451+ T. Record _ _ -> badFlexSuper direction super tipe
452+ T. Unit -> badFlexSuper direction super tipe
453+ T. Tuple _ _ _ -> badFlexSuper direction super tipe
454+ T. Alias _ _ _ _ -> badFlexSuper direction super tipe
455455
456456 T. BadRigidVar x tipe ->
457457 case tipe of
@@ -535,7 +535,7 @@ badDoubleRigid x y =
535535 [ D. toSimpleHint $
536536 " Your type annotation uses `" ++ N. toString x ++ " ` and `" ++ N. toString y ++
537537 " ` as separate type variables. Your code seems to be saying they are the\
538- \ same though! Maybe they should be the same in your type annotation?\
538+ \ same though. Maybe they should be the same in your type annotation?\
539539 \ Maybe your code uses them in a weird way?"
540540 , D. reflowLink " Read" " type-annotations" " for more advice!"
541541 ]
@@ -554,30 +554,16 @@ toASuperThing super =
554554-- BAD SUPER HINTS
555555
556556
557- badFlexSuper :: T. Super -> T. Type -> [D. Doc ]
558- badFlexSuper super tipe =
557+ badFlexSuper :: T. Direction -> T. Super -> T. Type -> [D. Doc ]
558+ badFlexSuper direction super tipe =
559559 case super of
560560 T. Comparable ->
561561 [ D. toSimpleHint " Only ints, floats, chars, strings, lists, and tuples are comparable."
562562 ]
563563
564564 T. Appendable ->
565- case tipe of
566- T. Type home name _ | T. isInt home name ->
567- [ D. toFancyHint [" Try" ," using" ,D. green" String.fromInt" ," to" ," convert" ," it" ," to" ," a" ," string?" ]
568- ]
569-
570- T. Type home name _ | T. isFloat home name ->
571- [ D. toFancyHint [" Try" ," using" ,D. green" String.fromFloat" ," to" ," convert" ," it" ," to" ," a" ," string?" ]
572- ]
573-
574- T. FlexSuper T. Number _ ->
575- [ D. toFancyHint [" Try" ," using" ,D. green" String.fromInt" ," to" ," convert" ," it" ," to" ," a" ," string?" ]
576- ]
577-
578- _ ->
579- [ D. toFancyHint [" Only" ," strings" ," and" ," lists" ," are" ," appendable." ," Put" ," it" ," in" ,D. green " []" ," to" ," make" ," it" ," a" ," list?" ]
580- ]
565+ [ D. toSimpleHint " Only strings and lists are appendable."
566+ ]
581567
582568 T. CompAppend ->
583569 [ D. toSimpleHint " Only strings and lists are both comparable and appendable."
@@ -586,8 +572,14 @@ badFlexSuper super tipe =
586572 T. Number ->
587573 case tipe of
588574 T. Type home name _ | T. isString home name ->
589- [ D. toFancyHint [" Try" ," using" ,D. green" String.toInt" ," to" ," convert" ," it" ," to" ," a" ," number?" ]
590- ]
575+ case direction of
576+ T. Have ->
577+ [ D. toFancyHint [" Try" ," using" ,D. green " String.fromInt" ," to" ," convert" ," it" ," to" ," a" ," string?" ]
578+ ]
579+
580+ T. Need ->
581+ [ D. toFancyHint [" Try" ," using" ,D. green " String.toInt" ," to" ," convert" ," it" ," to" ," an" ," integer?" ]
582+ ]
591583
592584 _ ->
593585 [ D. toFancyHint [" Only" ,D. green " Int" ," and" ,D. green " Float" ," values" ," work" ," as" ," numbers." ]
0 commit comments