[fix] the continuation example.

This commit is contained in:
Yamada Ryo 2024-09-01 18:29:35 +09:00
parent bfa8ed3786
commit ce837c56b6
No known key found for this signature in database
GPG Key ID: AAE3C7A542B02DBF

View File

@ -9,7 +9,7 @@ module Main where
import Control.Effect (type (~>))
import Control.Effect.ExtensibleChurch (runEff, type (:!!))
import Control.Effect.Hefty (interposeK, interpretRec, interpretRecH)
import Control.Effect.Hefty (Elab, interposeK, interpretRec, interpretRecH)
import Control.Monad.IO.Class (liftIO)
import Data.Effect.TH (makeEffectF, makeEffectH)
import Data.Function ((&))
@ -28,10 +28,10 @@ data ResetFork f a where
ResetFork :: Monoid w => f w -> ResetFork f w
makeEffectH [''ResetFork]
applyResetFork :: Fork <| r => Int -> ResetFork ('[] :!! r) ~> '[] :!! r
applyResetFork :: Fork <| r => Int -> Elab ResetFork ('[] :!! r)
applyResetFork numberOfFork (ResetFork m) =
m & interposeK pure \k Fork -> do
r <- mapM k [1 .. numberOfFork]
m & interposeK pure \resume Fork -> do
r <- mapM resume [1 .. numberOfFork]
pure $ mconcat r
main :: IO ()