
10 Aug
2015
10 Aug
'15
11:14 a.m.
On 10/08/2015 at 08:40:43 -0400, amindfv@gmail.com wrote:
There's an even nicer way! Use view patterns:
allMinus m ns = [ n' | ((?- m) -> Just n') <- ns ]
In this case it's not bad, but in some cases the guarded form is clearer, e.g. f z ys = [g x y | y@(flip h z -> Just x) <- ys] vs. f z ys = [g x y | y <- ys, Just x <- [h y z]] tho this is personal preference.