[Haskell-cafe] function type def

2008-04-01 Thread PR Stanley
HI It's one of those things - I know sort of instinctively why it is so but can't think of the formal rationale for it: f g x = g (g x) :: (t - t) - (t - t) Why not (t - t) - t - (t - t) to take account of the argument x for g? Cheers Paul ___

Re: [Haskell-cafe] function type def

2008-04-01 Thread Ketil Malde
PR Stanley [EMAIL PROTECTED] writes: It's one of those things - I know sort of instinctively why it is so but can't think of the formal rationale for it: f g x = g (g x) :: (t - t) - (t - t) (t - t) - (t - t) So g :: t - t x :: t Thus f :: (t - t) - t - t (The last parenthesis is

Re: [Haskell-cafe] function type def

2008-04-01 Thread jerzy . karczmarczuk
PR Stanley: I know sort of instinctively why it is so but can't think of the formal rationale for it: f g x = g (g x) :: (t - t) - (t - t) First of all - it is not the definition f g x = ... :: (t- ... but the type of the function which might be specified: f :: (t-t)-t-t Then, the answer

Re: [Haskell-cafe] function type def

2008-04-01 Thread PR Stanley
Try putting this through your GHCI: :t twice f x = f (f x) I'd presume that based on the inference of (f x) f is (t - t) and x :: t Yes, Maybe I should get the right associativity rule cleared first. Cheers, Paul At 20:35 01/04/2008, you wrote: PR Stanley: I know sort of instinctively why it