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

vlado vlado at dikini.net
Fri Mar 19 12:49:42 EDT 2010


> http://code.haskell.org/~basvandijk/code/only-read-or-write-vars/
> 
> This is a Request For Comments, so any comments / patches / +1s / -1s
> about anything are more than welcome before I upload it to hackage
> (sometime this weekend).

+1 - I like it, I've used this technique in some private projects

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.

Vlado



More information about the Haskell-Cafe mailing list