[Haskell-cafe] Chan with priorities
Andras Slemmer
0slemi0 at gmail.com
Mon May 26 09:10:27 UTC 2014
STM is very simple to use, you create transactions in the STM monad
(actions that should be executed as an atomic unit) then execute them with
atomically :: STM a -> IO a. Under the hood the STM monad creates a
dependency graph of the used STM primitives (TVars) in order to know when
to undo/redo transactions. But from what I understand you'll pretty much
only need to use (atomically . readTChan c)/(atomically . writeTChan c)
which are in the IO monad
On 26 May 2014 11:01, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
> Hello Haskell-cafe,
>
> can you please point me to any OSS implementation of IO Channels with
> priorities - i.e. data pushed to the Chan using high priority should
> be read prior to the data pushed with lower priority:
>
> pushChan ch 1 'x'
> pushChan ch 2 'y'
> readChan ch >>= print -- prints 'y'
>
> i've found only STM implementations - i don't know STM enough, may be
> i just need to convert STM to IO operations?
>
> i don't expect strong guarantees, my algorithm will remain correct
> anyway. and i don't have lot of objects, it's just a few dozens
>
>
>
> --
> Best regards,
> Bulat mailto:Bulat.Ziganshin at gmail.com
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140526/23076d35/attachment.html>
More information about the Haskell-Cafe
mailing list