@@ -1084,7 +1084,7 @@ opRightToDocs localizer category op tipe expected =
1084 "==" -> badEquality localizer "==" tipe expected
1084 "==" -> badEquality localizer "==" tipe expected
1085 "/=" -> badEquality localizer "/=" tipe expected
1085 "/=" -> badEquality localizer "/=" tipe expected
1087− "::" -> error "TODO"
1087+ "::" -> badConsRight localizer category tipe expected
1088 "++" -> badAppendRight localizer category tipe expected
1088 "++" -> badAppendRight localizer category tipe expected
@@ -1133,25 +1133,29 @@ opRightToDocs localizer category op tipe expected =
1136+ badOpRightFallback localizer category op tipe expected
1139+badOpRightFallback :: T.Localizer -> Category -> N.Name -> T.Type -> T.Type -> RightDocs
1140+badOpRightFallback localizer category op tipe expected =
1136− EmphRight
1141+ EmphRight
1144+ "The right argument of (" <> N.toString op <> ") is causing problems."
1146+ typeComparison localizer tipe expected
1139− "The right argument of (" <> N.toString op <> ") is causing problems."
1148+ toDescription category "The right argument is"
1141− typeComparison localizer tipe expected
1143− toDescription category "The right argument is"
1145− "But (" <> N.toString op <> ") needs the right argument to be:"
1150+ "But (" <> N.toString op <> ") needs the right argument to be:"
1147− [ H.toSimpleHint $
1152+ [ H.toSimpleHint $
1148− "With operators like (" ++ N.toString op ++ ") I always check the left\
1153+ "With operators like (" ++ N.toString op ++ ") I always check the left\
1149− \ side first. If it seems fine, I assume it is correct and check the right\
1154+ \ side first. If it seems fine, I assume it is correct and check the right\
1150− \ side. So the problem may be in how the left and right arguments interact!"
1155+ \ side. So the problem may be in how the left and right arguments interact!"
1157isInt :: T.Type -> Bool
1161isInt :: T.Type -> Bool
@@ -1195,6 +1199,59 @@ isList tipe =
1205+badConsRight :: T.Localizer -> Category -> T.Type -> T.Type -> RightDocs
1206+badConsRight localizer category tipe expected =
1208+ T.Type home1 name1 [actualElement] | T.isList home1 name1 ->
1210+ T.Type home2 name2 [expectedElement] | T.isList home2 name2 ->
1213+ H.reflow "I am having trouble with this (::) operator:"
1215+ typeComparison localizer expectedElement actualElement
1217+ "The left side of (::) is an element of type:"
1219+ "But the right side is a list filled with elements of type:"
1221+ case expectedElement of
1222+ T.Type home name [_] | T.isList home name ->
1224+ "Are you trying to append two lists? The (++) operator\
1225+ \ appends lists, whereas the (::) operator is only for\
1226+ \ adding ONE element to a list."
1231+ "Lists need ALL elements to be the same type though."
1237+ badOpRightFallback localizer category "::" tipe expected
1242+ H.reflow "The (::) operator can only add elements onto lists."
1244+ loneType localizer tipe expected
1246+ H.reflow $ toDescription category "The right side is"
1248+ [H.fillSep ["But","(::)","needs","a",H.dullyellow "List","on","the","right."]
1198-- BAD APPEND
1255-- BAD APPEND