Skip to content

Commit

Permalink
Add suspend
Browse files Browse the repository at this point in the history
  • Loading branch information
bartavelle committed Mar 11, 2016
1 parent 78d5d21 commit 35cfc3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Backends/Coroutine.hs
Expand Up @@ -38,8 +38,11 @@ instance MonadTrans (Coroutine s) where
instance MonadIO m => MonadIO (Coroutine s m) where
liftIO = lift . liftIO

suspend :: Monad m => (s, Coroutine s m r) -> Coroutine s m r
suspend s = Coroutine (return (Left s))

yield :: Monad m => x -> Coroutine x m ()
yield x = Coroutine (return (Left (x, return ())))
yield x = suspend (x, return ())

data AP = AP Age Turn PlayerId (NonEmpty Card) GameState
data AC = AC Age PlayerId (NonEmpty Card) GameState Message
Expand Down

0 comments on commit 35cfc3f

Please sign in to comment.