#7802 closed bug (duplicate)

kindFunResult in monad transformer

Reported by: tobsan Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.1
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:


This is probably related to the existing (fixed?) bug(s) about kindFunResult, but better safe than sorry.

I was writing a brainfuck interpreter, and tried changing this code:

getptrval = gets mem >>= \a -> gets ptr >>= lift . readArray a

to this (which probably wouldn't even work):

getptrval = liftM2 (lift . readArray) (gets ptr) (gets mem)

which gives this error message from GHC:

Brainfuck.hs:53:21:ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.1 for x86_64-unknown-linux):
<<details unavailable>>

Related type information:

type BFMonad a = StateT BFState IO a
data BFState = BF {
    pc, ptr :: Int,
    mem     :: IOUArray Int Int,
    program :: UArray Int Char

Change History (1)

comment:1 Changed 13 months ago by monoidal

  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the report. In fact "getptrval = liftM2 lift" is enough to trigger panic in GHC 7.6. This is fixed in the development version (bugs #7368, #7441).

[You might have wanted something like liftM2 (\a b -> lift (readArray a b)) (gets mem) (gets ptr) but I did not check whether that works.]

Note: See TracTickets for help on using tickets.