[GHC] #11555: catch under unsafePerformIO breaks on -O1 to catch _|_ breaks at -O1

GHC ghc-devs at haskell.org
Mon Feb 8 15:14:18 UTC 2016


#11555: catch under unsafePerformIO breaks on -O1 to catch _|_ breaks at -O1
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  8.0.1-rc2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by NeilMitchell):

 The current title is inaccurate - this ticket is all about {{{catch
 _|_}}}, and has nothing to do with {{{unsafePerformIO}}}.

 The question is whether {{{catch _|_}}} should evaluate to {{{_|_}}} or
 {{{Left}}}. I observe that in all previous releases of GHC, and at
 {{{-O0}}}, it's been {{{Left}}}. In two applications that have excellent
 test suites and have upgraded to GHC 8.0RC2 this issue has been flagged as
 a breaking change, so I suspect that it might be relatively widespread.

 As to what it should do, it seems unfortunate to argue that {{{catch
 undefined}}} is itself undefined. What's the semantics of {{{catch (return
 () >> undefined)}}}? If it's not equivalent to {{{catch undefined}}} then
 it's problematic for the Monad laws. I think it's reasonable in a lazy
 language that a function only evaluates its arguments when it has to.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11555#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list