You will have to write orMaybe as
orMaybe Nothing y = y
orMaybe x _ = x
though. (By the way, your original code for orMaybe doesn't seem to do
what you want.) This function has already been implemented for you, it's
called
mplus
My function 'orMaybe' takes two arguments m1 m2, if one of them is Nothing, it returns Nothing, if m1 is Just , it returns m1, if m2 is Just, it returns m2. This seems to be what I want. Why is this incorrect?
However, your function 'orMaybe' is much more concise and elegant.
thanks ...
-deech