on master help sign in
Give a proper error on mutually recursive type aliases
dd00462Evan Czaplicki
src/Reporting/Error/Canonicalize.hs+9−1
@@ -196,7 +196,15 @@ toHint err =
196 ++ "like List which are recursive, but do not get expanded into infinite types."
196 ++ "like List which are recursive, but do not get expanded into infinite types."
197
197
198 MutuallyRecursive aliases ->
198 MutuallyRecursive aliases ->
199− error "TODO" aliases
199+ "This type alias is part of a mutually recursive set of type aliases.\n"
200+ ++ "The following type aliases all depend on each other in some way:\n"
201+ ++ concatMap showName aliases ++ "\n\n"
202+ ++ "The problem is that when you try to expand any of these type aliases, they\n"
203+ ++ "expand infinitely! To fix, first try to centralize them into one alias."
204+ where
205+ showName (R.Region start _, name, _, _) =
206+ "\n " ++ name ++ replicate (65 - length name) ' '
207+ ++ "line " ++ show (R.line start)
200
208
201 Import name importError ->
209 Import name importError ->
202 case importError of
210 case importError of