I have a function a->b
which is to be passed to something of (c->a->b)
signature. I don't care about c
will just ignore it. Is there a standard function that prepends useless parameters: (a->b) -> (c->a->b)
?
flip f takes its (first) two arguments in the reverse order of f. flip f takes its (first) two arguments in the reverse order of f.
Elementary HaskellA function that takes another function (or several functions) as an argument is called a higher-order function.
Parameters in Haskell are rather reversed compared to imperative or object oriented languages. In an object oriented language, the object to work on is the very first parameter. In a function call it is often written even before the function name, say file in file.write("bla") .
Elem Function This function is used to check whether the supplied list contains a specific element or not. Accordingly, it either returns a true or a false. The following code checks whether the supplied list of elements contains the value 786.
It's called const
:
> let foo = const :: (a -> b) -> (c -> a -> b)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With