Skip to content

GHC hangs while producing error message for incorrect TypeFamilies application

Here's a minimally reproducible example:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Main where

newtype Token f a = Token { unToken :: f a }

class Class x (f :: * -> *) where
  type Meta x f :: *
  type Body x f :: *
  type Body x f = Token f Meta

main :: IO ()
main = return ()

This hangs like so

[2 of 2] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/foo-exe/foo-exe-tmp/Main.o )

I tested on 8.2.2 and 8.0.2 and got the same behavior.

The closest existing bug report I could find was #12386 (closed).

Trac metadata
Trac field Value
Version 8.2.2
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