[Haskell-cafe] RFC: only-read-or-write-vars

Bas van Dijk v.dijk.bas at gmail.com
Sat Mar 20 10:08:31 EDT 2010


On Fri, Mar 19, 2010 at 5:49 PM, vlado <vlado at dikini.net> wrote:
> +1 - I like it, I've used this technique in some private projects

Nice, I hope you can use this package.

> I wonder if this would be a place to add a function returning the pair
> of the read and write capabilities (for the lack of a better word) of a
> value.
>
> something like:
>
> rwPair:: v α -> (ReadOnly v α , WriteOnly v α)
> rwPair a = (readOnly a, writeOnly a)
>
> sorry for the lame name, but my name game is off today.
>
> This particular function comes handy when playing with passing channels
> or pointers around. It might be worth it to have a dedicated type for
> that as well.

What would this dedicated type look like?

BTW thanks for pointing me to pointers! Of course a Ptr is also a
mutable variable so I've added instances for them.

Thanks,

Bas


More information about the Haskell-Cafe mailing list