
22 Nov
2005
22 Nov
'05
1:40 p.m.
On Tue, 22 Nov 2005, Matthias Neubauer wrote:
Arjan van IJzendoorn
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