Hi, I'm new to Haskell, but I've asked around on some of the freenode communities and nobody there can help me. This may not be a bug, but simply my inexperience.
f :: [a] -> a
f = [u, v] -> (v - (u u u))
grad f [1, 1] works just fine in GHCI
map (\x -> grad x) [f] gives the following error:
Couldn't match type ‘Integer’
with ‘Numeric.AD.Internal.Reverse.Reverse s a’
Expected type: [Numeric.AD.Internal.Reverse.Reverse s a]
-> Numeric.AD.Internal.Reverse.Reverse s a
Actual type: [Integer] -> Integer
• In the first argument of ‘grad’, namely ‘f’
In the expression: grad f
In the first argument of ‘map’, namely ‘(\ f -> grad f)’
• Relevant bindings include
it :: [[a] -> [a]] (bound at :6:1)
I've tried many different ways of partially applying grad to a list of functions but cannot get it to typecheck.
Hi, I'm new to Haskell, but I've asked around on some of the freenode communities and nobody there can help me. This may not be a bug, but simply my inexperience.
f :: [a] -> a f = [u, v] -> (v - (u u u))
grad f [1, 1] works just fine in GHCI
map (\x -> grad x) [f] gives the following error: Couldn't match type ‘Integer’ with ‘Numeric.AD.Internal.Reverse.Reverse s a’ Expected type: [Numeric.AD.Internal.Reverse.Reverse s a] -> Numeric.AD.Internal.Reverse.Reverse s a Actual type: [Integer] -> Integer • In the first argument of ‘grad’, namely ‘f’ In the expression: grad f In the first argument of ‘map’, namely ‘(\ f -> grad f)’ • Relevant bindings include it :: [[a] -> [a]] (bound at:6:1)
I've tried many different ways of partially applying grad to a list of functions but cannot get it to typecheck.