Skip to content

GHC 7.10 rejects nullary type class with associated data

In GHC 7.8.4, the following code is legal:

{-# LANGUAGE NullaryTypeClasses, TypeFamilies #-}
module NullaryData where

class NullaryClass where
    data NullaryData

In GHC 7.10, NullaryTypeClasses was deprecated in favor of MultiParamTypeClasses. However, running this code on GHC 7.10-rc1:

{-# LANGUAGE MultiParamTypeClasses, TypeFamilies #-}
module NullaryData where

class NullaryClass where
    data NullaryData

results in this error:

NullaryData.hs:4:1:
    The associated type ‘NullaryData’
    mentions none of the type or kind variables of the class ‘NullaryClass’
    In the class declaration for ‘NullaryClass’

It's probably related to this earlier bugfix.

Trac metadata
Trac field Value
Version 7.10.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information