The function infix of Haskell

Source: Internet
Author: User

In Haskell, functions are generally performed using prefixes. But there is a way to change the prefix to infix.

All we need to do is wrap the function together, and we can turn a function with 2 parameters into infix form.

Prelude> "A" ' Notelem ' ["B"] true prelude> Notelem "a" ["B"] True

function infix, not only can have 2 parameters of the function into infix form, can also be more than 2 functions into infix form.

But it looks pretty ugly.

Prelude> FOLDL (+) 0 [1..5]15prelude> ((+) ' foldl ' 0) [1..5]15

The most useful place for a function to infix personal feelings is to stream the data, enter the data from a function, and then enter the next function sequentially. And these functions just need to be written down in the normal order, without having to write in reverse.

FST Col ' Notelem ' ["Order"] using infix method (notelem.fst) Col ["Order"]


The function infix of Haskell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.