What are the functions that begin with ($)
or (>>=)
supposed to do. I'm not asking exactly what $
or >>=
mean but I understand that
f :: Int -> Int
f x = x+2
is a function that takes an integer and adds two, but whilst learning Haskell I've ran into problems where the solution has been something like the following:
($) :: (a -> b) -> (a -> b)
f $ x = f x
from What does $ mean/do in Haskell?
I assume this means the function ($) takes a lambda (a -> b) and outputs a lambda (a -> b), and then the next line I'm unsure.
but I always assumed the function definition
f :: Int -> Int
had to be followed by a function with arguments starting with f like my first code example.
Thanks