Skip to content

Type checker hangs

The following module causes ghc --make and ghci to hang. -ddump-tc-trace produces output indefinitely.

{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleContexts #-}

import Generics.MultiRec
import Control.Monad.Writer

data AnyF s f where
  AnyF :: s ix -> f ix -> AnyF s f

children :: HFunctor s (PF s) => s ix -> (PF s) r ix -> [AnyF s r]
children p x = execWriter (hmapM p collect x) where
  collect :: (HFunctor s (PF s)) => s ix -> r ix -> Writer [AnyF s r] (r ix)
  collect w x = tell [AnyF w x] >> return x

Module Generics.MultiRec is from Hackage package multirec-0.4.

The code contains a type error: if arguments p and collect are swapped the code compiles fine.

I haven't tried making this example any smaller.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown/Multiple
Architecture Unknown/Multiple
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information