
4 Sep
2008
4 Sep
'08
5:39 p.m.
minh thu wrote:
Do you suggest I use
data Thing = Thing | None
and IORef Thing instead of
data Thing = Thing
and Maybe (IORef Thing) ?
I'm writing a data structure that can hold Things (and that can be mutated) or nothing (there is a hole in the wrapping data).
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. Paul.