Hello,I have some questions about the Automatic Differentiation package in Haskell (https://hackage.haskell.org/package/ad-4.3.2.1/docs/Numeric )-AD.html I need to compute the jacobian with that method and I have a type problem, here a simplified example in order to focus on the error:According to documentation I need to write "jacobian function values". So I built the input function. Please notice this is important for me that my function may depend on an external parameter (named factor here)testFunctionForJacobian :: Fractional a => a -> [a] -> [a]testFunctionForJacobian factor inputs = [(sum inputs) * factor]Then, using jacobian function of Numeric.AD in terminal, as a test, it works perfectly>jacobian (testFunctionForJacobian 2) [1,2]< [[2.0,2.0]]No apparent type problem here> :t (testFunctionForJacobian 2)(testFunctionForJacobian 2) :: Fractional a => [a] -> [a]But, I would like to insert that in a bigger function computing the jacobiantestJacobian :: Fractional a => a -> [a] -> [[a]]
testJacobian factor inputs = jacobian (testFunctionForJacobian factor) inputsThis time it generates an error message about factorCouldn't match expected type ‘Numeric.AD.Internal.Reverse.Reverse s a’ with actual type ‘a’
‘a’ is a rigid type variable bound by the type signature for
testJacobian :: Fractional a => a -> [a] -> [[a]] s a’All in all, my type seems implicitly correct in the terminal example but I did not manage to write it explicitly in my function.Here the jacobian function signature to help you answer me:--Jonas Béal