[GHC] #15052: DeriveAnyClass instances may skip TypeError constraints
GHC
ghc-devs at haskell.org
Wed Apr 18 18:21:02 UTC 2018
#15052: DeriveAnyClass instances may skip TypeError constraints
-------------------------------------+-------------------------------------
Reporter: jcpetruzza | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.2.2
Resolution: | Keywords:
| CustomTypeErrors
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by jcpetruzza):
Ok, I think I understand your point: what we see follows from the
documented behaviour for `DerivingAnyClass` so there is really no bug
here.
Tbh, I hadn't noticed until right now that `deriving` would propagate
constraints coming from the default signatures! The initial example in the
docs says:
> {{{#!haskell
> data Foo = Foo deriving (Show, SPretty)
> }}}
>
> The above code is equivalent to:
>
> {{{#!haskell
> data Foo = Foo deriving Show
> instance SPretty Foo
> }}}
and somehow the idea that `deriving` would declare the instance over an
empty context got stuck in my head for a long time. Hence my insistance in
expecting the results to be the same! (maybe `Foo a` would make for a
better example there?)
In any case, I agree that `deriving` is doing the right thing here. It is
a bit unfortunate since I'm not sure I want to use `TypeError` as it is
for generic default methods then, but on the other hand, without it error
messages can be a screenful!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15052#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list