Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,241
    • Issues 5,241
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 563
    • Merge requests 563
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13380
Closed
Open
Issue created Mar 05, 2017 by David Feuer@treeowlReporter

raiseIO# result looks wrong

primops.txt.pp includes the following note:

raiseIO# needs to be a primop, because exceptions in the IO monad must be precise - we don't want the strictness analyser turning one kind of bottom into another, as it is allowed to do in pure code.

But we do want to know that it returns bottom after being applied to two arguments, so that this function is strict in y

f x y | x>0       = raiseIO blah
| y>0       = return 1
| otherwise = return 2

I believe the "But we do" portion is, unfortunately, entirely wrong. From a user perspective, it is extremely strange to replace a precise exception with an imprecise one. That is, I strongly believe the above code should be considered lazy in y. The function f calculates an IO action; the value of y is only necessary to calculate that action if x is non-positive.

We can, conservatively, say for certain that the second component of the result of raiseIO# (i.e., the "return value") is bottom. We can also say, given

case raiseIO# e s of
  (# s', r #) -> q

that q is dead (we could replace it by (# s', undefined #)).

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking