diff --git a/effectful-core/src/Effectful/Dispatch/Static.hs b/effectful-core/src/Effectful/Dispatch/Static.hs index cf2e044..7b567cd 100644 --- a/effectful-core/src/Effectful/Dispatch/Static.hs +++ b/effectful-core/src/Effectful/Dispatch/Static.hs @@ -28,7 +28,7 @@ module Effectful.Dispatch.Static -- * Primitive API , Env , Relinker(..) - , noRelinker + , dummyRelinker -- ** Representation of effects , EffectRep diff --git a/effectful-core/src/Effectful/Error/Static.hs b/effectful-core/src/Effectful/Error/Static.hs index bb727e7..7dce2f9 100644 --- a/effectful-core/src/Effectful/Error/Static.hs +++ b/effectful-core/src/Effectful/Error/Static.hs @@ -104,7 +104,7 @@ runError runError m = unsafeEff $ \es0 -> mask $ \release -> do eid <- newErrorId size0 <- sizeEnv es0 - es <- unsafeConsEnv (Error @e eid) noRelinker es0 + es <- unsafeConsEnv (Error @e eid) dummyRelinker es0 r <- tryErrorIO release eid es `onException` unsafeTailEnv size0 es unsafeTailEnv size0 es pure r diff --git a/effectful-core/src/Effectful/Internal/Env.hs b/effectful-core/src/Effectful/Internal/Env.hs index aefc576..e341630 100644 --- a/effectful-core/src/Effectful/Internal/Env.hs +++ b/effectful-core/src/Effectful/Internal/Env.hs @@ -19,7 +19,7 @@ module Effectful.Internal.Env -- ** Relinker , Relinker(..) - , noRelinker + , dummyRelinker -- * Operations , emptyEnv @@ -163,16 +163,16 @@ newForkId (ForkIdGen ref) = do ---------------------------------------- -- Relinker --- | A function for relinking 'Env' objects stored in the handlers when cloning --- the environment. +-- | A function for relinking 'Env' objects stored in the handlers and/or making +-- a deep copy of the representation of the effect when cloning the environment. newtype Relinker :: (Effect -> Type) -> Effect -> Type where Relinker :: ((forall es. Env es -> IO (Env es)) -> rep e -> IO (rep e)) -> Relinker rep e --- | A dummy 'Relinker' that does nothing. -noRelinker :: Relinker rep e -noRelinker = Relinker $ \_ -> pure +-- | A dummy 'Relinker'. +dummyRelinker :: Relinker rep e +dummyRelinker = Relinker $ \_ -> pure ---------------------------------------- -- Operations diff --git a/effectful-core/src/Effectful/Internal/Monad.hs b/effectful-core/src/Effectful/Internal/Monad.hs index 3a22caf..d256b1c 100644 --- a/effectful-core/src/Effectful/Internal/Monad.hs +++ b/effectful-core/src/Effectful/Internal/Monad.hs @@ -398,7 +398,7 @@ runStaticRep -> Eff es (a, StaticRep e) runStaticRep e0 m = unsafeEff $ \es0 -> do size0 <- sizeEnv es0 - E.bracket (unsafeConsEnv e0 noRelinker es0) + E.bracket (unsafeConsEnv e0 dummyRelinker es0) (unsafeTailEnv size0) (\es -> (,) <$> unEff m es <*> getEnv es) @@ -411,7 +411,7 @@ evalStaticRep -> Eff es a evalStaticRep e m = unsafeEff $ \es0 -> do size0 <- sizeEnv es0 - E.bracket (unsafeConsEnv e noRelinker es0) + E.bracket (unsafeConsEnv e dummyRelinker es0) (unsafeTailEnv size0) (\es -> unEff m es) @@ -424,7 +424,7 @@ execStaticRep -> Eff es (StaticRep e) execStaticRep e0 m = unsafeEff $ \es0 -> do size0 <- sizeEnv es0 - E.bracket (unsafeConsEnv e0 noRelinker es0) + E.bracket (unsafeConsEnv e0 dummyRelinker es0) (unsafeTailEnv size0) (\es -> unEff m es *> getEnv es) diff --git a/effectful/src/Effectful/Resource.hs b/effectful/src/Effectful/Resource.hs index b9915f0..00fce7f 100644 --- a/effectful/src/Effectful/Resource.hs +++ b/effectful/src/Effectful/Resource.hs @@ -39,7 +39,7 @@ runResource m = unsafeEff $ \es0 -> do size0 <- sizeEnv es0 istate <- R.createInternalState mask $ \restore -> do - es <- unsafeConsEnv (Resource istate) noRelinker es0 + es <- unsafeConsEnv (Resource istate) dummyRelinker es0 a <- restore (unEff m es) `catch` \e -> do unsafeTailEnv size0 es RI.stateCleanupChecked (Just e) istate