Search code examples
haskellfunctional-programmingpointfreetacit-programming

How to write this function in point-free style?


How to rewrite the following function in point-free style, removing the parameter x from the definition completely (the other two may stay):

between min max x = (min < x) && (x < max)

This is not an assignment, just a question. I don't know how to proceed. I can turn it into a lambda function

between min max = \x -> (min < x) && (x < max)

but this is not point-free, as x is still there. Please help.


Solution

  • Another solution (needs import of Control.Applicative):

    between min max = liftA2 (&&) (min <) (max >)