diff --git a/src/Lib.hs b/src/Lib.hs index 722c346..58f45ca 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -49,7 +49,7 @@ runTeletype = interpret $ \case -- main = runM (runState "fuck" foom) >>= print -runState :: s -> Eff (State s ': r) a -> Eff r a +runState :: s -> Eff (State s ': r) a -> Eff r (a, s) runState = stateful $ \case Get -> S.get Put s' -> S.put s' diff --git a/src/Wtf.hs b/src/Wtf.hs index 110a5a6..f388447 100644 --- a/src/Wtf.hs +++ b/src/Wtf.hs @@ -7,7 +7,7 @@ import Eff.Type import Data.Functor.Identity countDown :: Int -> Int -countDown start = run $ runState "hello" $ runState start go +countDown start = fst $ fst $ run $ runState "hello" $ runState start go where go :: Eff '[State Int, State String, Identity] Int go = get >>= (\n -> if n <= 0 then (pure n) else (put (n-1)) >> go)