{"action":"closed","issue":{"url":"https://api.github.com/repos/purescript-contrib/purescript-aff-coroutines/issues/19","repository_url":"https://api.github.com/repos/purescript-contrib/purescript-aff-coroutines","labels_url":"https://api.github.com/repos/purescript-contrib/purescript-aff-coroutines/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/purescript-contrib/purescript-aff-coroutines/issues/19/comments","events_url":"https://api.github.com/repos/purescript-contrib/purescript-aff-coroutines/issues/19/events","html_url":"https://github.com/purescript-contrib/purescript-aff-coroutines/issues/19","id":334623910,"node_id":"MDU6SXNzdWUzMzQ2MjM5MTA=","number":19,"title":"The example does not work as expected","user":{"login":"joopringelberg","id":1141656,"node_id":"MDQ6VXNlcjExNDE2NTY=","avatar_url":"https://avatars2.githubusercontent.com/u/1141656?v=4","gravatar_id":"","url":"https://api.github.com/users/joopringelberg","html_url":"https://github.com/joopringelberg","followers_url":"https://api.github.com/users/joopringelberg/followers","following_url":"https://api.github.com/users/joopringelberg/following{/other_user}","gists_url":"https://api.github.com/users/joopringelberg/gists{/gist_id}","starred_url":"https://api.github.com/users/joopringelberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joopringelberg/subscriptions","organizations_url":"https://api.github.com/users/joopringelberg/orgs","repos_url":"https://api.github.com/users/joopringelberg/repos","events_url":"https://api.github.com/users/joopringelberg/events{/privacy}","received_events_url":"https://api.github.com/users/joopringelberg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-21T19:20:35Z","updated_at":"2018-06-22T07:56:01Z","closed_at":"2018-06-22T07:56:01Z","author_association":"NONE","body":"The documentation provides the following example:\r\n\r\n    produce \\emit -> do\r\n      log \"Working...\"\r\n      emit (Left \"progress\")\r\n      log \"Done!\"\r\n      emit (Right \"finished\")\r\nI expect this output:\r\n\r\n    Working...\r\n    progress\r\n    Done!\r\n    finished\r\nBut I see this:\r\n\r\n    Working...\r\n    Done!\r\nwhich I think shows that the consumer does not receive any value. \r\nThe Aff example (with produceAff) does work as expected.\r\nBelow is the full code. I've used version 6.0.0 and Aff 4.1.1.\r\n\r\n    module Main where\r\n    \r\n    import Control.Monad.Eff (Eff)\r\n    import Control.Coroutine (Consumer, Producer, consumer, runProcess, ($$))\r\n    import Control.Coroutine.Aff (produce)\r\n    import Control.Monad.Aff (Aff, runAff)\r\n    import Control.Monad.Eff.AVar (AVAR)\r\n    import Control.Monad.Eff.Class (liftEff)\r\n    import Control.Monad.Eff.Console (CONSOLE, log, logShow)\r\n    import Control.Monad.Eff.Exception (EXCEPTION)\r\n    import Data.Either (Either(..))\r\n    import Data.Maybe (Maybe(..))\r\n    import Prelude\r\n    \r\n    type EmitFunction a r eff = (Either a r -> Eff (avar :: AVAR | eff) Unit)\r\n    \r\n    p :: forall eff. Producer String (Aff (console :: CONSOLE, avar :: AVAR | eff)) String\r\n    p = produce f\r\n      where\r\n    \r\n      f :: EmitFunction String String (console :: CONSOLE | eff) -> Eff (avar :: AVAR, console :: CONSOLE | eff) Unit\r\n      f emit = do\r\n        log \"Working...\"\r\n        emit (Left \"progress\")\r\n        log \"Done!!!\"\r\n        emit (Right \"finished\")\r\n    \r\n    c :: forall eff. Consumer String (Aff (console :: CONSOLE | eff)) String\r\n    c = consumer \\s -> liftEff (log s) $> Nothing\r\n    \r\n    main :: forall eff. Eff (console :: CONSOLE, avar :: AVAR, err :: EXCEPTION | eff) Unit\r\n    main = void $ runAff logShow $ runProcess (p $$ c)\r\n    \r\n    {-\r\n    $ pulp run\r\n    * Building project in /Users/joopringelberg/Code/purescript-node-net\r\n    * Build successful.\r\n    Working...\r\n    Done!!!\r\n    -}\r\n    "}}
{"actor":{"display_login":"joopringelberg"}}