[Haskell-beginners] question about pattern guards
Daniel Trstenjak
daniel.trstenjak at gmail.com
Sat Sep 21 15:34:05 CEST 2013
> What am I missing?
You can combine booleans by '||', but 'Just n <- x' doesn't result to a
boolean.
You can use '<|>' from 'Control.Applicative' to get the desired behavoir.
f x y
| Just _ <- x <|> y = 1
| otherwise = 2
Greetings,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130921/fae8088b/attachment.htm>
More information about the Beginners
mailing list