[Haskell-cafe] [announcement] filtrable: class of filtrable containers

Kosyrev Serge _deepfire at feelingofgreen.ru
Wed Feb 17 12:21:08 UTC 2016


Oleg Grenrus <oleg.grenrus at iki.fi> writes:
> And one more comment:
>
> The law:
>
>     filter f = mapMaybe (liftA2 (<$) id (guard ∘ f))
>
> is very hard to understand.
>
>     filter f = mapMaybe (\x -> if f x then Just x else Nothing)

Wow, the difference is simply astounding for me.

Does this monster

  liftA2 (<$) id (guard ∘ f)

really stand for

  \x -> if f x then Just x else Nothing

?

Is there really no simpler "compact" representation for this trivial idea in Haskell?

-- 
с уважениeм / respectfully,
Косырев Сергей


More information about the Haskell-Cafe mailing list