Fundeps work even for unary type classes
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 26 Oct 2016 09:54:16 +0000 (10:54 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 26 Oct 2016 10:13:18 +0000 (11:13 +0100)
commit801c26372742fc79bd3756bdcb710031c716c402
tree5e9bdbe7d1a9bfbbe08eb4cca810a19e6e76b8c3
parenta182c0e81b59494b4c8b4c03b7b9b68d81ee3381
Fundeps work even for unary type classes

The functional-dependency improvement functions,
   improveFromAnother
   improveFromInstEnv
had a side-condition that said the type class has to have at
least two arguments.  But not so, as Trac #12763 shows:

   class C a | -> a where ...

is perfectly legal, albeit a bit of a corner case.
compiler/typecheck/FunDeps.hs
testsuite/tests/typecheck/should_compile/T12763.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T12763.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_fail/T5684.stderr