@@ -40,7 +40,7 @@ import Control.Monad.IO.Class
40import Control.Monad.IO.Unlift
40import Control.Monad.IO.Unlift
41import Control.Monad.Trans.Control
41import Control.Monad.Trans.Control
42import GHC.Magic (oneShot)
42import GHC.Magic (oneShot)
43−import System.IO.Unsafe (unsafePerformIO)
43+import System.IO.Unsafe (unsafeDupablePerformIO)
45import Effectful.Internal.Effect
45import Effectful.Internal.Effect
46import Effectful.Internal.Env
46import Effectful.Internal.Env
@@ -57,7 +57,10 @@ runEff (Eff m) =
57 -- unsafePerformIO is safe here since IOE was not on the stack, so no IO with
57 -- unsafePerformIO is safe here since IOE was not on the stack, so no IO with
58 -- side effects was performed (unless someone sneakily introduced side effects
58 -- side effects was performed (unless someone sneakily introduced side effects
59 -- with unsafeEff, but then all bets are off).
59 -- with unsafeEff, but then all bets are off).
60− unsafePerformIO $ m =<< emptyEnv
60+ --
61+ -- Moreover, internals don't allocate any resources that require explicit
62+ -- cleanup actions to run, so the "Dupable" part should also be just fine.
63+ unsafeDupablePerformIO $ m =<< emptyEnv
62unsafeEff :: (Env es -> IO a) -> Eff es a
65unsafeEff :: (Env es -> IO a) -> Eff es a
63unsafeEff m = Eff (oneShot m)
66unsafeEff m = Eff (oneShot m)