Hi,

while experimenting with template haskell I encountered the following:

] ghc --make Main.hs
] Chasing modules from: Main.hs
] Skipping  Power            ( Power.hs, ./Power.o )
] Compiling Main             ( Main.hs, ./Main.o )
] ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
]         nameModule x {- v a1fV -}
] 
] Please report it as a compiler bug to [EMAIL PROTECTED],
] or http://sourceforge.net/projects/ghc/.
] 
] 
] make: *** [main] Error 1

This was using a version very recently checked out of CVS (Friday, 14 March)

The files that caused the problem are attached.

--
Tom Harke
Computer Science and Engineering Department
Oregon Graduate Institute

Weiler's Law:
  Nothing is impossible for the man who doesn't have to do it himself
{-# OPTIONS -fglasgow-exts -DTEMPLATE_HASKELL #-}
module Power
where

import Language.Haskell.THSyntax

power :: Int -> Expr -> Expr
power n =
  \x ->
    if n==0
      then [| 1 |]
      else [| $x * $(power (n-1) x) |]
{-# OPTIONS -fglasgow-exts -DTEMPLATE_HASKELL #-}
import Language.Haskell.THSyntax
import Power

main = 
  do
    putStrLn
      $ show
      -- an attempt to abstract : $(power 2 [| 3 |] )
      $ (\x -> $(power 2 [| x |] )) 3

Reply via email to