[GHC] #5936: Support for data families in generics
GHC
cvs-ghc at haskell.org
Tue Mar 13 02:24:42 CET 2012
#5936: Support for data families in generics
------------------------------+---------------------------------------------
Reporter: reinerp | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Currently {{{DeriveGeneric}}} doesn't handle data families correctly, so
that the following module
{{{
{-# LANGUAGE TypeFamilies, DeriveGeneric #-}
module FamilyDerive where
import GHC.Generics
data family F a
data instance F Int = FInt deriving Generic
}}}
fails to compile, with error
{{{
/tmp/FamilyDerive.hs:6:15:
Couldn't match type `Rep (F Int)' with `M1 t0 t1 (M1 t2 t3 U1)'
The type variables `t0', `t1', `t2', `t3' are ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Expected type: Rep (F Int) x
Actual type: M1 t0 t1 (M1 t2 t3 U1) x
In the pattern: M1 (M1 U1)
In an equation for `to': to (M1 (M1 U1)) = FInt
In the instance declaration for `Generic (F Int)'
}}}
It turns out to require only small changes to GHC to handle data families.
I've attached patches.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5936>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list