On Tue, 22 Nov 2005, Matthias Neubauer wrote:

Arjan van IJzendoorn <[EMAIL PROTECTED]> writes:

Is there a shorter way to write the if-then-else part below?
       if (cmdType cmd) /= (CmdSitError Server)
          then return $ Just seat_num
          else return Nothing

return $ if cmdType cmd /= CmdSitError Serv
                then Just seat_num else Nothing

return $ guard (cmdType cmd /= CmdSitError Serv) >> return seat_num

Because I often need it, I'm used to use my private function 'toMaybe'

return $ toMaybe (cmdType cmd /= CmdSitError Serv) seat_num
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to