@@ -80,11 +80,11 @@ actuallyUnify span variable1 variable2 = do
80 unifyNumber svar name
80 unifyNumber svar name
81 | name `elem` ["Int","Float","number"] = flexAndUnify svar
81 | name `elem` ["Int","Float","number"] = flexAndUnify svar
82 | otherwise = TS.addError span (Just hint) variable1 variable2
82 | otherwise = TS.addError span (Just hint) variable1 variable2
83− where hint = "A number must be an Int or Float"
83+ where hint = "A number must be an Int or Float."
85 comparableError maybe =
85 comparableError maybe =
86 TS.addError span (Just $ Maybe.fromMaybe msg maybe) variable1 variable2
86 TS.addError span (Just $ Maybe.fromMaybe msg maybe) variable1 variable2
87− where msg = "A comparable must be an Int, Float, Char, String, list, or tuple"
87+ where msg = "A comparable must be an Int, Float, Char, String, list, or tuple."
89 unifyComparable var name
89 unifyComparable var name
90 | name `elem` ["Int","Float","Char","String","comparable"] = flexAndUnify var
90 | name `elem` ["Int","Float","Char","String","comparable"] = flexAndUnify var
@@ -98,7 +98,7 @@ actuallyUnify span variable1 variable2 = do
98 unify' v =<< liftIO (var $ Is Comparable)
98 unify' v =<< liftIO (var $ Is Comparable)
100 | length vs > 6 ->
100 | length vs > 6 ->
101− comparableError $ Just "Cannot compare a tuple with more than 6 elements"
101+ comparableError $ Just "Cannot compare a tuple with more than 6 elements."
102 | otherwise ->
102 | otherwise ->
103 do flexAndUnify varSuper
103 do flexAndUnify varSuper
104 cmpVars <- liftIO $ forM [1..length vs] $ \_ -> var (Is Comparable)
104 cmpVars <- liftIO $ forM [1..length vs] $ \_ -> var (Is Comparable)
@@ -113,13 +113,8 @@ actuallyUnify span variable1 variable2 = do
113 rigidError variable = TS.addError span (Just hint) variable1 variable2
113 rigidError variable = TS.addError span (Just hint) variable1 variable2
115 var = "'" ++ render (pretty Never variable) ++ "'"
115 var = "'" ++ render (pretty Never variable) ++ "'"
116− hint = concat
116+ hint = "Cannot unify rigid type variable " ++ var ++
117− [ "This probably relates to a type annotation. A type "
117+ ".\nThe problem probably relates to a type annotation."
118− , "annotation may say ", var, " but should be a more "
119− , "specific type. Also, type variables are not "
120− , "shared between type annotations, so ", var, " in one "
121− , "is not the same as " ++ var ++ " in another. "
122− , "Something like that happened" ]
124 superUnify =
119 superUnify =
125 case (flex desc1, flex desc2, name desc1, name desc2) of
120 case (flex desc1, flex desc2, name desc1, name desc2) of