@@ -124,16 +124,20 @@ localUnliftIO (LocalEnv les) strategy k = case strategy of
127−-- @forall localEs. 'Eff' localEs a -> 'Eff' localEs b@
127+-- @'Eff' localEs a -> 'Eff' localEs b@
129-- /Note:/ the operation must not run its argument in a separate thread,
129-- /Note:/ the operation must not run its argument in a separate thread,
130-- attempting to do so will result in a runtime error.
130-- attempting to do so will result in a runtime error.
131withLiftMap
131withLiftMap
132 :: HasCallStack
132 :: HasCallStack
134+ -- ^ Local environment.
133− => ((forall a b localEs. (Eff es a -> Eff es b) -> Eff localEs a -> Eff localEs b) -> Eff es r)
135+ -> ((forall a b. (Eff es a -> Eff es b) -> Eff localEs a -> Eff localEs b) -> Eff es r)
134 -- ^ Continuation with the lifting function in scope.
136 -- ^ Continuation with the lifting function in scope.
135 -> Eff es r
137 -> Eff es r
136−withLiftMap k = unsafeEff $ \es -> do
138+withLiftMap !_ k = unsafeEff $ \es -> do
139+ -- The LocalEnv parameter is not used, but we need it to constraint the
140+ -- localEs type variable. It's also strict so that callers don't cheat.
137 (`unEff` es) $ k $ \mapEff m -> unsafeEff $ \localEs -> do
141 (`unEff` es) $ k $ \mapEff m -> unsafeEff $ \localEs -> do
138 seqUnliftEff localEs $ \unlift -> do
142 seqUnliftEff localEs $ \unlift -> do
139 (`unEff` es) . mapEff . unsafeEff_ $ unlift m
143 (`unEff` es) . mapEff . unsafeEff_ $ unlift m
@@ -144,7 +148,7 @@ withLiftMap k = unsafeEff $ \es -> do
147−-- @forall localEs. 'Eff' localEs a -> 'Eff' localEs b@
151+-- @'Eff' localEs a -> 'Eff' localEs b@
149-- /Note:/ the operation must not run its argument in a separate thread,
153-- /Note:/ the operation must not run its argument in a separate thread,
150-- attempting to do so will result in a runtime error.
154-- attempting to do so will result in a runtime error.
@@ -159,16 +163,20 @@ withLiftMap k = unsafeEff $ \es -> do
161-- runFork :: IOE :> es => Eff (Fork : es) a -> Eff es a
165-- runFork :: IOE :> es => Eff (Fork : es) a -> Eff es a
162−-- runFork = interpret $ \env (ForkWithUnmask m) -> withLiftMapIO $ \liftMap -> do
166+-- runFork = interpret $ \env (ForkWithUnmask m) -> withLiftMapIO env $ \liftMap -> do
163-- localUnliftIO env (ConcUnlift Ephemeral $ Limited 1) $ \unlift -> do
167-- localUnliftIO env (ConcUnlift Ephemeral $ Limited 1) $ \unlift -> do
164-- forkIOWithUnmask $ \unmask -> unlift $ m $ liftMap unmask
168-- forkIOWithUnmask $ \unmask -> unlift $ m $ liftMap unmask
166withLiftMapIO
170withLiftMapIO
167 :: (HasCallStack, IOE :> es)
171 :: (HasCallStack, IOE :> es)
173+ -- ^ Local environment.
168− => ((forall a b localEs. (IO a -> IO b) -> Eff localEs a -> Eff localEs b) -> Eff es r)
174+ -> ((forall a b. (IO a -> IO b) -> Eff localEs a -> Eff localEs b) -> Eff es r)
169 -- ^ Continuation with the lifting function in scope.
175 -- ^ Continuation with the lifting function in scope.
170 -> Eff es r
176 -> Eff es r
171−withLiftMapIO k = k $ \mapIO m -> unsafeEff $ \es -> do
177+withLiftMapIO !_ k = k $ \mapIO m -> unsafeEff $ \es -> do
178+ -- The LocalEnv parameter is not used, but we need it to constraint the
179+ -- localEs type variable. It's also strict so that callers don't cheat.
172 seqUnliftEff es $ \unlift -> mapIO $ unlift m
180 seqUnliftEff es $ \unlift -> mapIO $ unlift m
174----------------------------------------
182----------------------------------------