TH bug?

Reto Kramer kramer at acm.org
Wed Nov 27 16:54:17 EST 2002


If tried to compile the Print.hs file below (based on the yesterday's 
mailing list discussion around the th printf example). I get the 
following error message (5.05, MAIN line, Nov 26th build), but I'm not 
sure if I did something really silly or if there's a genuine bug in the 
compiler.  Can you pls have quick look at the Print.hs source below and 
see if you can spot the reason for the ghc crash?

Thanks,
- Reto

bash-2.05a$ lghc -fglasgow-exts -package haskell-src  
-i./src:./ext/HUnit-1.0 -odir./bin -hidir./bin -tmpdir./tmp -Wall -c 
./src/Print.hs
ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
         rename/RnExpr.lhs:164: Non-exhaustive patterns in function 
rnExpr


Please report it as a compiler bug to glasgow-haskell-bugs at haskell.org,
or http://sourceforge.net/projects/ghc/.



module Print(pr) where

import Language.Haskell.THSyntax

data Format = D | S | L String

parse :: String -> [Format]
parse s   = [ L s ]

gen :: [Format] -> Expr
gen [D]   = [| \n -> show n |]
gen [S]   = [| \s -> s |]
gen [L s] = string s

pr :: String -> Expr
pr s      = gen (parse s)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1134 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20021127/43a7f01f/attachment.bin


More information about the Glasgow-haskell-bugs mailing list