I've created a list of partially applied functions in my REPL like so:
listOfPartiallyAppliedFunctions = map (*) [1..100]
I would then like to create the list of results from completing the function application, which I can easily do by providing a lambda to the map function like so:
let results = map (\x -> x 4) listOfPartiallyAppliedFunctions
Which basically means map the function x applied to 4 over the list of partially applied functions, where x is each partially applied function from the list.
However, I thought it would then follow that I could write:
let results = map (4) listOfPartiallyAppliedFunctions
As there shouldn't be a need to provide a lambda to the map function as it should know to apply 4 to the partially applied functions contained in the listOfPartiallyAppliedFunctions
.
However, I am getting this error:
• Non type-variable argument in the constraint: Num ((a -> a) -> b)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a b. (Num a, Num ((a -> a) -> b), Enum a) => [b]
Can someone help me parse this error? I thought 4
was an instance of type constructor Num?