<div dir="ltr">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<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 26 May 2014 11:01, Bulat Ziganshin <span dir="ltr"><<a href="mailto:bulat.ziganshin@gmail.com" target="_blank">bulat.ziganshin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Haskell-cafe,<br>
<br>
can Â you please point me to any OSS implementation of IO Channels with<br>
priorities Â - Â i.e. data pushed to the Chan using high priority should<br>
be read prior to the data pushed with lower priority:<br>
<br>
pushChan ch 1 'x'<br>
pushChan ch 2 'y'<br>
readChan ch >>= print -- prints 'y'<br>
<br>
i've Â found only STM implementations - i don't know STM enough, may be<br>
i just need to convert STM to IO operations?<br>
<br>
i Â don't Â expect Â strong Â guarantees, my algorithm will remain correct<br>
anyway. and i don't have lot of objects, it's just a few dozens<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Best regards,<br>
 Bulat Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â mailto:<a href="mailto:Bulat.Ziganshin@gmail.com">Bulat.Ziganshin@gmail.com</a><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</font></span></blockquote></div><br></div>