Skip to content

IO hack in demand analyzer can miss I/O

If someone digs into the IO type, they could (with good reason, even!) decide that they want to produce something other than an unboxed pair. Here's an example, imitating StateT st IO a in a way that's sure to be unboxed well:

newtype IOState st a = IOState
  { unIOState :: State# RealWorld
              -> st
              -> (# State# RealWorld, st, a #) }

This won't trip io_hack_reqd, so demand analysis won't see it as I/O, and everything will be wrong. Urk. Furthermore, in the future, we may allow newtypes around unlifted types, in which case this stuff gets even messier.

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