attrap
attrap copied to clipboard
Haskell fixer: curried constraints
When attempting to repair a missing constraint, we end up with curried constraints:
foo :: (A, B) => C -> D
bar :: C -> D
bar c = foo c
-- after two repairs, the type of bar is:
-- bar :: A => B => C -> D
While this is entirely correct, it is not idiomatic, so I was wondering if it was possible to detect existing constraints, add parentheses if needed, and insert constraints after the first one in the parentheses so that repair would yield
bar :: (A, B) => C -> D
It's certainly possible, but I consider the usefulness/maintenance burden too low.