Re: [Haskell-cafe] Hit a wall with the type system

2007-11-30 Thread David Roundy
On Thu, Nov 29, 2007 at 04:25:43PM -0800, Dan Weston wrote: I must be missing something, because to me the contract seems to be much simpler to express (than the Functor + Isomorphism route you seem to me to be heading towards): ... diff f a = if dx == dx' then error Zero denom else dydx

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-29 Thread Henning Thielemann
On Wed, 28 Nov 2007, Chris Smith wrote: data AD a = AD a a deriving Eq instance Show a = Show (AD a) where show (AD x e) = show x ++ + ++ show e ++ eps instance Num a = Num (AD a) where (AD x e) + (AD y f) = AD (x + y) (e + f) (AD x e) - (AD y f)

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-29 Thread Henning Thielemann
On Thu, 29 Nov 2007, Henning Thielemann wrote: On Wed, 28 Nov 2007, Chris Smith wrote: diffNum:: Num b= (forall a. Num a= a - a) - b - b diffFractional :: Fractional b = (forall a. Fractional a = a - a) - b - b diffFloating :: Floating b = (forall

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-29 Thread Dan Weston
I must be missing something, because to me the contract seems to be much simpler to express (than the Functor + Isomorphism route you seem to me to be heading towards): diff :: (Eq x, Dense x, Subtractible x, Subtractible y, Divisible y x yOverX) = (x - y) -

[Haskell-cafe] Hit a wall with the type system

2007-11-28 Thread Chris Smith
I was talking to a few people about this on #haskell, and it was suggested I ask here. I should say that I'm playing around here; don't mistake this for an urgent request or a serious problem. Suppose I wanted to implement automatic differentiation of simple functions on real numbers; then

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-28 Thread Luke Palmer
On Nov 29, 2007 4:02 AM, Chris Smith [EMAIL PROTECTED] wrote: I was talking to a few people about this on #haskell, and it was suggested I ask here. I should say that I'm playing around here; don't mistake this for an urgent request or a serious problem. Suppose I wanted to implement

Re: [Haskell-cafe] Hit a wall with the type system

2007-11-28 Thread Luke Palmer
On Nov 29, 2007 4:31 AM, Luke Palmer [EMAIL PROTECTED] wrote: On Nov 29, 2007 4:02 AM, Chris Smith [EMAIL PROTECTED] wrote: I was talking to a few people about this on #haskell, and it was suggested I ask here. I should say that I'm playing around here; don't mistake this for an urgent