diff options
Diffstat (limited to 'Control/Concurrent/Go.hs')
-rw-r--r-- | Control/Concurrent/Go.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Control/Concurrent/Go.hs b/Control/Concurrent/Go.hs index 92444f4..5057bfe 100644 --- a/Control/Concurrent/Go.hs +++ b/Control/Concurrent/Go.hs @@ -49,7 +49,7 @@ fork = Concurrent.forkIO chan :: Int -> IO (Channel a) chan n = do (i, o) <- Chan.newChan n - return <| Channel i o n + pure <| Channel i o n -- | A channel for broadcasting to multiple consumers. See 'mult'. type Mult a = Chan.OutChan a @@ -64,7 +64,7 @@ mult = Chan.dupChan <. _in -- You can use this to read from a channel in a background process, e.g.: -- -- >>> c <- Go.chan --- >>> Go.fork <. forever <| Go.mult c >>= Go.tap >>= print +-- >>> Go.fork <. forever <| Go.mult c +> Go.tap +> print tap :: Mult a -> IO a tap = Chan.readChan @@ -93,9 +93,9 @@ write = Chan.tryWriteChan <. _in -- >>> Go.read c -- "hi" -- >>> Go.fork --- >>> Go.fork <| forever <| Go.mult c >>= Go.tap >>= \t -> print ("one: " <> t) +-- >>> Go.fork <| forever <| Go.mult c +> Go.tap +> \t -> print ("one: " <> t) -- ThreadId 810 --- >>> Go.fork <| forever <| Go.mult c >>= Go.tap >>= \t -> print ("two: " <> t) +-- >>> Go.fork <| forever <| Go.mult c +> Go.tap +> \t -> print ("two: " <> t) -- ThreadId 825 -- >>> Go.write c "test" -- "two: t"eosnte": |