[Haskell-cafe] MVar style question

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Jan 5 10:34:15 EST 2007


Hello Chad,

Friday, January 5, 2007, 6:15:34 PM, you wrote:

> Thanks, you make some interesting points to consider. This leads me to
> wonder how these arguments might be extended to

> (1) IORef (a,b)     vs.     (IORef a, IORef b)

depends on whether you need to read/write both variables at the same or
different moments. also, "IORef a" may be optimized to "IOURef a" which
works faster

> (2) TVar (a,b)     vs.     (TVar a, TVar b)

i never worked with STM, but guess that TVar usage pattern is just the smae
as for MVar

btw, you can use type synonym to make switching from IORef to MVar easier:

type MyVar a = IORef a


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list