Created
September 18, 2024 22:37
-
-
Save solomon-b/b995b12c5ab761f0114343c46f1f9d89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE MagicHash #-} | |
| {-# LANGUAGE UnboxedTuples #-} | |
| -- | | |
| module RealWorld where | |
| -------------------------------------------------------------------------------- | |
| import GHC.Prim | |
| import GHC.Types | |
| import GHC.ST | |
| import GHC.Magic | |
| -------------------------------------------------------------------------------- | |
| unIO :: IO a -> State# RealWorld -> (# State# RealWorld, a #) | |
| unIO (IO a) = a | |
| print' :: Show x => x -> State# RealWorld -> (# State# RealWorld, () #) | |
| print' = unIO . print | |
| -- runAction :: (State# RealWorld -> (# State# RealWorld, a #)) -> State# RealWorld -> (# State# RealWorld, a #) | |
| runAction :: (State# RealWorld -> o) -> o | |
| runAction f = runRW# f | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment