RE: ghc-6.4.1: panic - Prelude.last: empty list

"Simon Peyton-Jones" <[email protected]> Mon, 14 Nov 2005 11:38:32 -0000
Newsgroups gmane.comp.lang.haskell.template
Message-ID <036EAC76E7F5EC4996A3B3C3657D411603ABBF78@EUR-MSG-21.europe.corp.microsoft.com>
Good point.

I've fixed this, in the HEAD at least (not sure whether it'll make it
into the stable branch).  Now the conversion from TH syntax to GHC's
syntax is done eagerly, so that no lurking exceptional values can
subsequently crash GHC.  

It also means that any errors found during this conversion process can
be reported more cleanly.

Simon

| -----Original Message-----
| From: [email protected]
[mailto:glasgow-haskell-bugs-
| [email protected]] On Behalf Of Bulat Ziganshin
| Sent: 30 October 2005 20:27
| To: Einar Karttunen
| Cc: [email protected];
[email protected]
| Subject: Re: ghc-6.4.1: panic - Prelude.last: empty list
| 
| Hello Einar,
| 
| Sunday, October 30, 2005, 4:20:20 PM, you wrote:
| 
| EK> I am having problems with GHC 6.4.1 dying with the message:
| 
| EK> ghc-6.4.1: panic! (the `impossible' happened, GHC version 6.4.1):
| EK>         Prelude.last: empty list
| 
| EK> The source is nontrivial and contains template haskell. The error
| EK> seems to appear after byte code generation.
| 
| are you will be glad to see trivial source of this problem? :)
| 
| 
| {-# OPTIONS_GHC -fglasgow-exts -fth #-}
| module Main where
| main = return ()
| $( [d| |] >>= return.tail)
| 
| 
| C:\!\Haskell\!!!!>ghc --make -ddump-splices test-derive.hs
| Chasing modules from: test-derive.hs
| Compiling Main             ( test-derive.hs, test-derive.o )
| Loading package base-1.0 ... linking ... done.
| Loading package haskell98-1.0 ... linking ... done.
| Loading package template-haskell-1.0 ... linking ... done.
| ghc.EXE: panic! (the `impossible' happened, GHC version 6.4.1):
|         Prelude.tail: empty list
| 
| Please report it as a compiler bug to
[email protected],
| or http://sourceforge.net/projects/ghc/.
| 
| 
| 
| as you see, TH sometimes just don't caught exceptions in your TH code.
| moreover, with -ddump-splices TH can print code it generated and only
| then panic on error in generation routine!
| 
| --
| Best regards,
|  Bulat                            mailto:[email protected]
| 
| 
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| [email protected]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs