haskellghcunsafe-perform-io

Why no `seq` in `accursedUnutterablePerformIO`?


Why is accursedUnutterablePerformIO (aka inlinePerformIO) implemented

accursedUnutterablePerformIO :: IO a -> a
accursedUnutterablePerformIO (IO a) = case a realWorld# of (# _, r #) -> r

and not

accursedUnutterablePerformIO :: IO a -> a
accursedUnutterablePerformIO (IO a) = case a realWorld# of (# s, r #) -> s `seq` r

?


Solution

  • Simply put, realWorld# doesn't exist runtime, therefore we can't do any computation on it, thus seq doesn't do anything either.