Type families difference between 7.0.4 and 7.2.1

Luite Stegeman stegeman at gmail.com
Mon Aug 15 14:12:14 CEST 2011


hi,

I've been trying to debug a problem with some code that causes name
conflicts with GHC 7.2.1, but not with 7.0.4.
The problem appears to be that in some cases, GHC 7.2.1 creates a
top-level data family, that was not there with 7.0.4. Here's a small
example:

-- C.hs
{-# LANGUAGE TypeFamilies #-}
module C where

class C1 a where
  data F a :: *

-- B.hs
{-# LANGUAGE TypeFamilies #-}

module B where

import qualified C

data B1 a = B1 a

instance C.C1 (B1 a) where
  data C.F (B1 a) = B2 a

data family D a

-- ghci 7.0.4
> ghci B
*B> :browse
data B1 a = B1 a
data instance B.R:FB1 (B1 a) = B2 a
data family D a

-- ghci 7.2.1
> ghci B
*B> :browse
data B1 a = B1 a
data instance B.R:FB1 (B1 a) = B2 a
data family D a
data family F a

I'm not sure what's going on, why there's a difference and whether
this actually is the problem (and not just a difference in the :browse
function).

In the original code in which I ran into the problem, there's a
similar top-level data family that wasn't there with GHC 7.0.4. The
original issue is here:
https://github.com/yesodweb/persistent/issues/17 , specifically
there's a data family Field, that appears to cause conflicts with
another Field type in Yesod. Unfortunately it's difficult to install
the packages due to dependencies that have not yet been updated for
7.2.1, and the problem is further obscured by being buried inside
template-haskell generated code.

luite



More information about the Glasgow-haskell-users mailing list