2008/9/3 Bulat Ziganshin <[EMAIL PROTECTED]>:
> 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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to