Skip to content

GHC hangs on (possibly dubious) associated type synonym default

Summary

This is my program:

{-# LANGUAGE TypeFamilies #-}
class Foo a where
   type Bar a
   type Bar (f a) = Bar a

Under GHC 8.8, this produces a "default declaration should have form..." error. However, if I try to compile under GHC 8.10.2, it outputs this and just hangs:

$ ghc -c bug.hs

bug.hs:4:4: error:

I also tried GHC 9.0.1-alpha1, same outcome:

$ ghci bug.hs 
GHCi, version 9.0.0: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( bug.hs, interpreted )

bug.hs:4:4: error:

It may be that what I'm trying to do here (have the type instance for, for example, Maybe a and Either b a default to that for a) doesn't make sense, but of course it should report an error without hanging forever.

Environment

  • GHC version used: 8.10.2, 9.0.1-alpha1.
  • Operating System: Linux x86_64
Edited by Galen Huntington
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information