[Haskell-cafe] Safe forward-mode AD in Haskell?

David Roundy droundy at darcs.net
Tue May 8 21:04:10 EDT 2007


On Tue, May 08, 2007 at 05:59:48PM -0700, David Roundy wrote:
> Couldn't you do the same without branding if you simply made your function
> polymorphic:
> 
> data Bundle a = Bundle a a
> 
> d :: Num a => (forall b. Num b => b -> b) -> a -> a
> d f x = let (Bundle y y') = f (Bundle x 1) in y'
> 
> and defined
> 
> lift x = Bundle x 0

I take it back.  This lift won't work.  You need a lift with the type

lift :: (Num a, Num b) -> a -> b

which would obviously need to be added to a class that would take the place
of Num here...
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Haskell-Cafe mailing list