jyp / attrap

ATtempt To Repair At Point (emacs flycheck extension)
GNU General Public License v3.0
43 stars 7 forks source link

Haskell fixer: curried constraints #4

Open aspiwack opened 6 years ago

aspiwack commented 6 years ago

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
jyp commented 6 years ago

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