I'm trying to figure why the person making the post failed. There are existing Haskell libraries for automatic differentiation [1].<p>As opposed to ordinary symbolic differentiation or numerical differentiation, automatic differentiation is a method that takes the code of a function and a value and returns the derivative of the function at run time.<p>Of course, the author is working with a vector library and so his version will take N-dimension vectors/tensors and a functions of these and return N+something dimension vectors/tensors. That part is kind of head spinning and I assume that's where things fell apart.<p>[1] <a href="http://hackage.haskell.org/package/ad" rel="nofollow">http://hackage.haskell.org/package/ad</a>