Improve type variables in `AST.Common.Type.toString`
Janiczek opened this issue · comments
Right now type variables get emitted this way:
Type.Var 123
->"t123"
It would be great to print them like a
and b
, like we're used to from the official Elm compiler.
Gotchas
Note that toString
for one Type
is not enough. In the error messages you sometimes compare two types together, so something like toStringHelper : Dict Int String -> Type -> (String, Dict Int String)
might be needed to allow you to thread names from one type into the other.
Eg. if the first Type is Function (Var 1) (Function (Var 2) Int)
and the second one is Function (Var 2) Bool
, they should be consistent with each other: a -> b -> Int
and b -> Bool
(not a -> Bool
, which would probably happen if you'd just call toString
without context and without threading the Dict through)