Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#8028 closed bug (fixed)

Panic on degenerate closed type family

Reported by: monoidal Owned by: goldfire
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Creating a degenerate closed type family via TH gives a panic in toBranchList.

module T where

import Language.Haskell.TH

x = do n <- newName "F"
       return [ClosedTypeFamilyD n [] Nothing []]
module A where

import T


Change History (4)

comment:1 Changed 6 years ago by simonpj

difficulty: Unknown
Owner: set to goldfire

Richard, I can tell you where to look for this.


comment:2 Changed 6 years ago by eir@…

commit 67aacde3c9ec04b6e8e8e1d921001b218eb5244f

Author: Richard Eisenberg <>
Date:   Tue Jul 2 21:07:07 2013 +0100

    Fix Trac #8028.
    Check for an empty list of equations when converting
    a closed type family from TH to an HsDecl.

 compiler/hsSyn/Convert.lhs |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

comment:3 Changed 6 years ago by goldfire

Resolution: fixed
Status: newclosed

Thanks for reporting!

comment:4 Changed 4 years ago by Adam Gundry <adam@…>

In 4efa421327cf127ebefde59b2eece693e37dc3c6/ghc:

Permit empty closed type families

Fixes #9840 and #10306, and includes an alternative resolution to #8028.
This permits empty closed type families, and documents them in the user
guide. It updates the Haddock submodule to support the API change.

Test Plan: Added `indexed-types/should_compile/T9840` and updated
`indexed-types/should_fail/ClosedFam4` and `th/T8028`.

Reviewers: austin, simonpj, goldfire

Reviewed By: goldfire

Subscribers: bgamari, jstolarek, thomie, goldfire

Differential Revision:

GHC Trac Issues: #9840, #10306
Note: See TracTickets for help on using tickets.