
3 Sep
2008
3 Sep
'08
12:37 p.m.
2008/9/3 Bulat Ziganshin
Hello minh,
Wednesday, September 3, 2008, 2:09:38 PM, you wrote:
I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null pointers.
i've not used this but overall it seems like a correct way to emulate NULL. the whole question is that you probably still think C if you need NULL pointers at all :)
Maybe, I'm adapting some C++ code... 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). Thanks, Thu