On Sep 4, 2008, at 12:50 PM, minh thu wrote:
I'd have thought you wanted "IORef (Maybe Thing)", which says that the
pointer always exists, but may not point to anything. On the other hand
"Maybe (IORef Thing)" says that the pointer may or may not exist.
Yes, someone else said it too. But you saiy that regarding the pointer. If you
look at the thing the pointer (if any) points at, what's the difference ?
Either there is none : Nothing or IORef Nothing, or there is one :
Just (IORef 5)
or IORef (Just 5).
There is still a difference. With Maybe (IORef a), the nothingness is expressed only locally, but with IORef (Maybe a), the nothingness can be shared and mutated by any other IORefs that point to it as well.