Nullary Typeclasses Always Require an Instance?
Summary
In GHCI, at least, creating a nullary typeclass of form "class Foo" does not allow you to use it as a constraint without defining a corresponding instance of Foo.
Actually, we've been discussing this on IRC (esoteric features of the type system!).
You're allowed to define a name with a Foo constraint in the type, but it creates type errors if you attempt to use it, unless you define an instance.
===
Also, apparently :t for such a name fails in GHCI. That's what got int-e interested in this.
Steps to reproduce
Load ghci enter "class Foo" enter "u :: Foo => Int; u = 3" enter "u" enter ":t u"
alternately:
Foo.hs
class Foo
u :: Foo => Int u = 3
main = print u
and attempt to compile with GHC
Expected behavior
Allow automatic instancing of nullary typeclasses?
Environment
- GHC version used: 9.4.4
Optional:
- Operating System:
- System Architecture: