Primops for making exceptions precise or hiding continuation strictness in IO
Currently we consider raiseIO# to be the only source of precise exceptions. This is really limiting.
Here are some basic operations we might want to provide:
-
considerExceptionsPrecise#:: (State# RealWorld -> (# State# RealWorld, a_reppoly #)) -> State# RealWorld -> (# State# RealWorld, a_reppoly #)-
considerExceptionsPrecise# a sis equivalent toa sexcept that when any synchronous exception (precise or imprecise) is raised by the the latter, it becomes a precise exception in the former. - With our current precise exceptions mechanism, this means that we must hide strictness from the continuation of
considerExceptionsPrecise# a sunless it can be proven thata sdoes not raise a synchronous exception.
-
hideContinuationStrictness#:: (State# RealWorld -> (# State# RealWorld, a_reppoly #)) -> State# RealWorld -> (# State# RealWorld, a_reppoly #)- At runtime,
hideContinuationStrictness# a sis equivalent toa s. Butcase hideContinuationStrictness# a s of (# s', r #) -> cont #)is lazy incont. This is similar in effect to our precise exceptions mechanism, but is not tied to whether the actiona sthrows an exception. - Or perhaps we could instead use
evalBarrier# :: State# RealWorld -> State# RealWorldand definehideContinuationStrictness# a s = case considerExceptionsPrecise# a s of (# s2, r #) -> case evalBarrier# s2 of s3 -> (# s3, r #). (TheconsiderExceptionsPrecise#here is not optional: Ifa sdiverges we will drop theevalBarrier#in the continuation. We can consider an exception to be precise iff it includes an eval barrier.)
Edited by Matthew Craven