
On Mon, Mar 26, 2012 at 4:25 PM, Ting Lei
Hi Antoine and Tobias (and everyone else),
Thanks a lot for your answers. They are really helpful
Can you please show me how to use the (Eq m) constraint to do this?
Also, my general question (probably novice-level) is that in monadic programming, you can convert not necessarily monadic codes into monadic ones. I know for many cases, it is impossible to do the reverse conversion, e.g. you can't make a function involving real IO operations into a pure code. In other cases, for example, I may need to using things like Nothing as the "null" value as in other programming languages, just to represent a special "missing" value outside the regular type. Is mzero a reasonable replacement for this or is there any reasonable (abstract) approximation in Haskell for doing this? (Like "null", I need the ability to detect it.)
I think using 'Maybe' (with Nothing) is perfect for this - this function should come in handy: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Maybe.... Antoine