Answer the question
In order to leave comments, you need to log in
Why does an error occur when using composition?
I made two functions like this:
prod:: [Integer] -> Integer
prod [] = 1
prod (num:list) = num * prod list
let fun = select [1..10] 5
prod . fun (>)
error:
• Couldn't match expected type ‘a -> [Integer]’
with actual type ‘[Integer]’
• Possible cause: ‘fun’ is applied to too many arguments
In the second argument of ‘(.)’, namely ‘fun (>)’
In the expression: prod . fun (>)
In an equation for ‘it’: it = prod . fun (>)
• Relevant bindings include
it :: a -> Integer (bound at <interactive>:156:1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question