
On 25/09/2008, at 11:27 AM, ajb@spamcop.net wrote:
Haskell doesn't have a notion of a one-element tuple.
Why not?
Perhaps more crucially, it's hard to see where such a thing would be useful.
IORef, and ML's ref types are sort of one element tuples. The ML ref type is more so, because you don't need a special monad to read and write its contents.. Ref types are useful because many different parts of your program can hold pointers to the outer constructor. By updating the constructor to hold a different value, you propagate this new value throughout your program in a single, constant time operation. Ref types can be very useful in practice. IORefs are used GHC's type inferencer to implement type substitution. They're also heavily used in interactive programs like frag[1] to propagate the current user input state throughout the program. Ben. [1] http://www.haskell.org/haskellwiki/Frag