This commit is contained in:
Sandy Maguire 2019-02-21 18:55:12 -05:00
parent 05fea09eb0
commit eba22cc6ac
2 changed files with 2 additions and 2 deletions

View File

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

View File

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