Help making exception-related primops open-kinded

David Feuer david.feuer at gmail.com
Fri Oct 2 20:42:39 UTC 2020


I'm pretty sure raiseIO#, catch#, maskAsyncExceptions#, and so on can
have open-kinded results. For example, we currently have

catch#
  :: (State# RealWorld -> (# State# RealWorld, a #) )
  -> (b -> State# RealWorld -> (# State# RealWorld, a #) )
  -> State# RealWorld
  -> (# State# RealWorld, a #)

but I think we *should* be able to have

catch#
  :: (State# RealWorld -> (# State# RealWorld, o #) )
  -> (b -> State# RealWorld -> (# State# RealWorld, o #) )
  -> State# RealWorld
  -> (# State# RealWorld, o #)

This should allow us to avoid boxing things just to be able to get
them out of a `catch#` or `maskAsyncExceptions#` block. But when I
tried just changing the types in primops.txt.pp, I got a type mismatch
error that seems to suggest some sort of GHC build staging issue. How
can I work around this? See
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4192/diffs for my
attempt.


More information about the ghc-devs mailing list