Rename noRelinker to dummyRelinker

This commit is contained in:
Andrzej Rybczak 2022-01-11 00:00:44 +01:00
parent 46c8feac58
commit 89c614b3aa
5 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,7 @@ module Effectful.Dispatch.Static
-- * Primitive API
, Env
, Relinker(..)
, noRelinker
, dummyRelinker
-- ** Representation of effects
, EffectRep

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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