attrap icon indicating copy to clipboard operation
attrap copied to clipboard

Haskell fixer: curried constraints

Open aspiwack opened this issue 7 years ago • 1 comments

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

aspiwack avatar Apr 12 '18 11:04 aspiwack

It's certainly possible, but I consider the usefulness/maintenance burden too low.

jyp avatar Sep 01 '18 09:09 jyp