Thanks to all who has replied in such a short time. >From your reponses, I looked at the definition of `mplus`
Nothing `mplus` ys = ys xs `mplus` _ = xs It catches the essence of what I am trying to do! Later, if pn grows in number, I can scale up by using some-kind-of-zero with some higher order foldx-like functions. Thanks a lot, --hp On Wed, 21 May 2008, HP Wei wrote: > > Suppose p1, p2, p3 are 3 predicates > that take an input -- say, a String. > They return either (True, result) > or False. > > I want to get an effect like in this expression: > > case p1 s of > (True, r) -> r > False -> case p2 s of > (True, r) -> r > False -> case p3 s of > (True, r) -> r > False -> none > > Is this a job for Maybe monad ? > How do I do that ? > > Thanks > HP > _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users