
Neil Mitchell wrote:
server text | Just xs <- parse text = let x | "field1" `elem` xs = error "... do one thing ..." | "field2" `elem` xs = error "... do something else ..." in x server _ = error "... invalid request ..."
This now has the wrong semantics - before if parse text returned Just [] the error invalid request branch was invoked, now its a pattern match failure.
I missed that, thanks. The MonadPlus way is not as elegant, but not too ugly I think: server text = do Just xs <- return $ parse text do guard $ "field1" `elem` xs return "... do one thing ..." `mplus` do guard $ "field2" `elem` xs return "... do something else ..." `mplus` return "... invalid request ..." Zun.