José Romildo Malaquias | 28 Oct 04:55 2012
Picon

ghc: panic! (the 'impossible' happened)

Hello.

Today I wrote a small program to experiment with the Applicative
class. The program is supposed to use an "applicative reader", similar
to a "monad reader", to evaluate arithmetic expressions.

But when compiling the program with ghc-7.6.1, I get the following message:

  $ ghc --make applicative-eval
  [1 of 1] Compiling Main             ( applicative-eval.hs, applicative-eval.o )
  ghc: panic! (the 'impossible' happened)
    (GHC version 7.6.1 for x86_64-unknown-linux):
    expectJust cpeBody:collect_args

  Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

If the line

  eval (Let s a b) = \m -> eval b ((s,eval a m):m)

is commented out, the program compiles without problems.

Is this a known issue with the compiler?

The source code is attached.

Romildo
Attachment (applicative-eval.hs): text/x-haskell, 1573 bytes
(Continue reading)

Sjoerd Visscher | 28 Oct 12:46 2012

Re: ghc: panic! (the 'impossible' happened)

You can avoid the error by replacing

  eval :: Exp -> (->) Memory Integer

with

  eval :: Exp -> Memory -> Integer

which should be the same, but apparently isn't internally in GHC. This is definitely a bug.

Sjoerd

On Oct 28, 2012, at 4:55 AM, José Romildo Malaquias <j.romildo <at> gmail.com> wrote:

> Hello.
> 
> Today I wrote a small program to experiment with the Applicative
> class. The program is supposed to use an "applicative reader", similar
> to a "monad reader", to evaluate arithmetic expressions.
> 
> But when compiling the program with ghc-7.6.1, I get the following message:
> 
>  $ ghc --make applicative-eval
>  [1 of 1] Compiling Main             ( applicative-eval.hs, applicative-eval.o )
>  ghc: panic! (the 'impossible' happened)
>    (GHC version 7.6.1 for x86_64-unknown-linux):
>    expectJust cpeBody:collect_args
> 
>  Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
> 
(Continue reading)

José Romildo Malaquias | 28 Oct 13:32 2012
Picon

Re: ghc: panic! (the 'impossible' happened)

On Sun, Oct 28, 2012 at 12:46:28PM +0100, Sjoerd Visscher wrote:
> You can avoid the error by replacing
> 
>   eval :: Exp -> (->) Memory Integer
> 
> with
> 
>   eval :: Exp -> Memory -> Integer
> 
> which should be the same, but apparently isn't internally in GHC. This is definitely a bug.

As I want the "reader applicative" to be explicit in the code, I have
rewritten my code as

  type Reader r a = r -> a

  eval :: Exp -> Reader Memory Integer

which also works.

Partial application of the (->) type constructor also works:

  type Reader r = (->) r

or

  type Reader = (->)

But the following tiggers the bug:

(Continue reading)

Simon Peyton-Jones | 28 Oct 19:51 2012
Picon

RE: ghc: panic! (the 'impossible' happened)

Thanks.  Certainly a bug. I've created a ticket http://hackage.haskell.org/trac/ghc/ticket/7372.

Turns out that it's fixed in HEAD already, and I *think* the fix is in
http://hackage.haskell.org/trac/ghc/ticket/7312, which should get into 7.6.2.

Simon

|  -----Original Message-----
|  From: glasgow-haskell-users-bounces <at> haskell.org [mailto:glasgow-haskell-users-
|  bounces <at> haskell.org] On Behalf Of Sjoerd Visscher
|  Sent: 28 October 2012 11:46
|  To: José Romildo Malaquias
|  Cc: glasgow-haskell-users <at> haskell.org
|  Subject: Re: ghc: panic! (the 'impossible' happened)
|  
|  You can avoid the error by replacing
|  
|    eval :: Exp -> (->) Memory Integer
|  
|  with
|  
|    eval :: Exp -> Memory -> Integer
|  
|  which should be the same, but apparently isn't internally in GHC. This is definitely
|  a bug.
|  
|  Sjoerd
|  
|  On Oct 28, 2012, at 4:55 AM, José Romildo Malaquias <j.romildo <at> gmail.com>
|  wrote:
(Continue reading)


Gmane