Last active
July 6, 2018 09:41
-
-
Save sighingnow/298bcf267321ffe2c4e7c394e609f1c6 to your computer and use it in GitHub Desktop.
Unsafe perform computation in some monads.
This file contains 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
import Control.Monad.ST | |
import System.IO.Unsafe | |
import Unsafe.Coerce | |
unsafePerformST :: ST s a -> a | |
unsafePerformST m = unsafePerformIO $ | |
stToIO $ -- unsafely do it | |
unsafeCoerce m -- convert to ST Realworld a | |
{-# NOINLINE unsafePerformST #-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment