I have a problem with generating GADTs with template Haskell. The problem is that I can't get the code to compile completely. GHCI does not terminate when loading the file and a ghc process uses much memory and cpu as it can get (2.4GB, 50~70%).
I tried to make a minimal example in which it still happens. It does not matter if I use the oxford notation ([| |]
) or build the function by applying the TH datatypes by hand.
Consider this simple module:
{-# LANGUAGE GADTs, TemplateHaskell #-}
module Test where
$( [d| data Test a where
T :: Test String
|] )
I'm using GHC 7.4.2 on OSX Mountain Lion from the Haskell Platform for x64.
Does anyone have an idea why this happens? Maybe I'm using some code incorrectly?