[GHC] #12731: Generic type class has type family; leads to big dep_finsts
GHC
ghc-devs at haskell.org
Mon Oct 24 15:30:46 UTC 2016
#12731: Generic type class has type family; leads to big dep_finsts
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords: Generics
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* keywords: => Generics
* cc: RyanGlScott (added)
Comment:
As you've discovered, it's possible to manually define `Generic` instances
(as long as Safe Haskell isn't enabled, I might point out). But even if we
restrict `Generic` instances to only be derived, I don't think that would
guarantee they don't overlap. After all, you can do this (requires GHC 8.0
or later):
{{{#!hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
import GHC.Generics
data Foo a = Foo a
deriving instance {-# OVERLAPPABLE #-} Generic (Foo a)
deriving instance {-# OVERLAPPING #-} Generic (Foo Int)
}}}
We used to forbid `Generic` instances like `Generic (Foo Int)` (see
#5939), but reverted that decision when we found out that it wreaked havoc
with sufficiently poly-kinded `Generic1` instances that require kinds to
be instantiated with `*` (see #11732).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12731#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list