Opened 10 months ago

Closed 4 months ago

Last modified 4 months ago

#9077 closed bug (worksforme)

Forcing the type to be IO {} instead of IO() causes a "panic! The impossible has happened" output.

Reported by: Westycoot Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Compile-time performance bug Test Case: rename/should_fail/T9077
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Below is the source code in which the bug occurs. It is easily reproduce-able, by having the type be IO{} instead of IO().

When ran, this code will produce the "panic! The impossible has happened" output. Which told me to report the bug here.

By changing IO() to IO{} (which I did by accident), no exception is thrown, it simply tells the user to panic!

    main :: IO {}
    main = do
            e1 <- getLine
            e2 <- getLine
            print ((read e1) + (read e2))


Attachments (1)

IO Monad error.hs (88 bytes) - added by Westycoot 10 months ago.

Download all attachments as: .zip

Change History (5)

Changed 10 months ago by Westycoot

comment:1 Changed 10 months ago by simonpj

I can't reproduce your crash. Can you show exact output and which compiler you are using? Like this:

bash$ ghc -c T9077.hs

T9077.hs:3:12: Record syntax is illegal here: {}

bash$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.2

bash$ cat T9077.hs
module Main where

main :: IO {}
main = do
            e1 <- getLine
            e2 <- getLine
            print ((read e1) + (read e2))

I speculate that you are not using 7.8.2.

comment:2 Changed 4 months ago by thomie

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

GHC 7.6.3 indeed panics on the given example, but 7.8.3 does not.

$ ghc-7.8.3 T9077.hs 
[1 of 1] Compiling Main             ( T9077.hs, T9077.o )

T9077.hs:1:12: Record syntax is illegal here: {}

Westycoot: please reopen if you're still having problems.

comment:3 Changed 4 months ago by simonpj

  • Test Case set to rename/should_fail/T9077

comment:4 Changed 4 months ago by Simon Peyton Jones <simonpj@…>

Note: See TracTickets for help on using tickets.