[Haskell-beginners] "Shortcut" for f (g x) (g x)

Mihai Maruseac mihai.maruseac at gmail.com
Mon Dec 4 16:34:26 UTC 2017

You can use `liftM2 f g g`

For the example you mentioned, there's also

    compare `on` snd


    comparing snd

with the proper imports (Data.Ord, Data.Function)

On Mon, Dec 4, 2017 at 8:31 AM, Baa <aquagnu at gmail.com> wrote:
> Hello, All!
> Does Haskell have some "short-form" for such call: `f (g x) (g x)`, for
> example:
>   compare (snd x) (snd x)
> Looks like combinatory logic or `ap` but not exactly...
> ===
> Best regards, Paul
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

Mihai Maruseac (MM)
"If you can't solve a problem, then there's an easier problem you can
solve: find it." -- George Polya

More information about the Beginners mailing list