|
|
|
|
|
by fusiongyro
4807 days ago
|
|
Did you misunderstand? do x <- a
y <- b
return $ x + y
can result in Nothing if either a or b is Nothing, but (fromMaybe 0 a) + (fromMaybe 0 b)
will always result in a number, with 0 being used in place of Nothing. If only one of them is Nothing, you'll get the value of the other, the Nothing having been treated as 0. |
|