Opened 5 years ago

Closed 5 years ago

#10020 closed bug (fixed)

GHC 7.10 rejects nullary type class with associated data

Reported by: RyanGlScott Owned by:
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.10.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case: indexed-types/should_compile/T10020
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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:

    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.

Change History (3)

comment:1 Changed 5 years ago by Simon Peyton Jones <simonpj@…>

In dda652826326022e4604d7b0fdc82c1993e32a67/ghc:

Fix the nullary-type-class case for associated types

It was already ok for methods.
Fixes Trac #10020

comment:2 Changed 5 years ago by simonpj

Status: newmerge
Test Case: indexed-types/should_compile/T10020

Thanks for reporting this.

comment:3 Changed 5 years ago by thoughtpolice

Milestone: 7.10.1
Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10 (via 4c8b65218c3ad4d040691453b60091b38a41a0b0).

Note: See TracTickets for help on using tickets.