Opened 3 years ago

Closed 3 years ago

#8993 closed bug (fixed)

Fold NullaryTypeClasses into MPTC

Reported by: owst Owned by:
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


NullaryTypeClasses are an instance of MultiParamTypeClasses, so make it so.

Suggested by Austin on reddit

Attachments (1)

0001-Subsume-NullaryTypeClasses-by-MultiParamTypeClasses.patch (8.3 KB) - added by owst 3 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 3 years ago by thoughtpolice

Status: newpatch

comment:2 Changed 3 years ago by simonpj

I'm fine with this, but I think the error message could be better. "Too many args" is better than "Invalid number of args". It would be easy to generate the same messages as before, by passing arity to classArityErr.


comment:3 Changed 3 years ago by owst

I've uploaded a new patch, which preserves the original messages, as per Simon's suggestion.


comment:4 Changed 3 years ago by thoughtpolice

Milestone: 7.10.1

Awesome, thanks!

comment:5 Changed 3 years ago by Krzysztof Gogolewski <krz.gogolewski@…>

In c63a465011b99eeafbb957074e54c2e6bbf751d9/ghc:

Subsume NullaryTypeClasses by MultiParamTypeClasses (#8993)

MPTC now also handles the nullary case

comment:6 Changed 3 years ago by monoidal

Resolution: fixed
Status: patchclosed

I've pushed - thanks for the patch!

comment:7 Changed 3 years ago by hvr

Resolution: fixed
Status: closednew

It seems that currently NullaryTypeClasses has no effect anymore? Specifically, make WAY=normal TEST=TcNullaryTC fails with

=====> TcNullaryTC(normal) 2009 of 4031 [0, 0, 0] 
cd ./typecheck/should_run && '/home/hvr/Haskell/GHC/ghc/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history -o TcNullaryTC TcNullaryTC.hs    >TcNullaryTC.comp.stderr 2>&1
Compile failed (status 256) errors were:

TcNullaryTC.hs:1:14: Warning:
    -XNullaryTypeClasses is deprecated: use -XMultiParamTypeClasses or pragma {-# LANGUAGE MultiParamTypeClasses #-} instead
[1 of 1] Compiling Main             ( TcNullaryTC.hs, TcNullaryTC.o )

    No parameters for class ‘R’
    (Use MultiParamTypeClasses to allow no-parameter classes)
    In the class declaration for ‘R’

*** unexpected failure for TcNullaryTC(normal)

comment:8 Changed 3 years ago by Herbert Valerio Riedel <hvr@…>

In 26f41922e8923185bc77ceb8ef44d23564d29bed/ghc:

Promote TcNullaryTC and TcCoercible to fast tests

I'm wondering whether it's sensible to omit so many typecheck testcases from
the default validate test target. As for instance, TcNullaryTC has been failing
since its introduction in c63a465011b99eeafbb957074e54c2e6bbf751d9 (re #8993) and
it seems to have gone unnoticed so far.

Signed-off-by: Herbert Valerio Riedel <>

comment:9 Changed 3 years ago by monoidal

Sorry about that. Will fix.

comment:10 Changed 3 years ago by Krzysztof Gogolewski <krz.gogolewski@…>

In e7b9c4125321308a7f71cacf4c24b7d40261ccfd/ghc:

Fixup nullary typeclasses (Trac #8993)

Summary: Fix test broken after Trac #8993

Test Plan: validate

Reviewers: austin, simonpj, hvr

Reviewed By: austin, hvr

Subscribers: simonmar, relrod, carter

Differential Revision:

comment:11 Changed 3 years ago by monoidal

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.