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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to