[Haskell-cafe] Re: Function Precedence

2008-04-07 Thread Aaron Denney
On 2008-04-03, Chris Smith <[EMAIL PROTECTED]> wrote: > Hans Aberg wrote: >> This problem is not caused by defining f+g, but by defining numerals as >> constants. > > Yup. So the current (Num thing) is basically: > > 1. The type thing is a ring > 2. ... with signs and absolute values > 3. ... alon

Re: [Haskell-cafe] Re: Function Precedence

2008-04-03 Thread Henning Thielemann
On Thu, 3 Apr 2008, [EMAIL PROTECTED] wrote: Fractional, Floating, etc. are also horrible. Why the square root needs to be floating? It can belong to the algebraic number domain. At least in NumericPrelude we have separated these issues. ___ Haskell

Re: [Haskell-cafe] Re: Function Precedence

2008-04-03 Thread Hans Aberg
On 3 Apr 2008, at 16:07, Chris Smith wrote: This problem is not caused by defining f+g, but by defining numerals as constants. Yup. So the current (Num thing) is basically: 1. The type thing is a ring 2. ... with signs and absolute values 3. ... along with a natural homomorphism from Z int

[Haskell-cafe] Re: Function Precedence

2008-04-03 Thread jerzy . karczmarczuk
Chris Smith writes: ... So the current (Num thing) is basically: 1. The type thing is a ring 2. ... with signs and absolute values 3. ... along with a natural homomorphism from Z into thing 4. ... and with Eq and Show. If one wanted to be perfectly formally correct, then each of 2-4 could be

Re: [Haskell-cafe] Re: Function Precedence

2008-04-03 Thread Bulat Ziganshin
Hello Chris, Thursday, April 3, 2008, 6:07:53 PM, you wrote: > On the other hand, I have enough time already trying to explain Num, > Fractional, Floating, RealFrac, ... to new haskell programmes. I'm not > sure it's an advantage if someone must learn the meaning of an additive > commutative sem

[Haskell-cafe] Re: Function Precedence

2008-04-03 Thread Chris Smith
Hans Aberg wrote: > This problem is not caused by defining f+g, but by defining numerals as > constants. Yup. So the current (Num thing) is basically: 1. The type thing is a ring 2. ... with signs and absolute values 3. ... along with a natural homomorphism from Z into thing 4. ... and with Eq a

Re: [Haskell-cafe] Re: Function Precedence

2008-04-02 Thread Loup Vaillant
2008/4/2, Dan Piponi <[EMAIL PROTECTED]>: > On Tue, Apr 1, 2008 at 2:07 PM, PR Stanley <[EMAIL PROTECTED]> wrote: > > All you'd have to do is to give the inner most function the highest > > precdence > > > What's the innermost function in "f g x" here? > > test :: (a -> b -> c) -> a -> b -> c >

Re: [Haskell-cafe] Re: Function Precedence

2008-04-02 Thread Dan Piponi
On Tue, Apr 1, 2008 at 2:07 PM, PR Stanley <[EMAIL PROTECTED]> wrote: > All you'd have to do is to give the inner most function the highest > precdence What's the innermost function in "f g x" here? test :: (a -> b -> c) -> a -> b -> c test f g x = f g x -- Dan __

[Haskell-cafe] Re: Function Precedence

2008-04-01 Thread Chris Smith
PR Stanley wrote: > All you'd have to do is to give the inner most function the highest > precdence therefore > f g x == f (g x) > let f x = x^2 > let g x = x`div`2 > f g 4 == error while > f (g 4) == 4 I'm afraid I still don't understand what you're proposing. How can f g x mean f (g x), and yet

Re: [Haskell-cafe] Re: Function Precedence

2008-04-01 Thread Brandon S. Allbery KF8NH
On Apr 1, 2008, at 17:07 , PR Stanley wrote: I'm beginning to wonder if I fully understand the right associativity rule for the -> operator. Read a parenthesized unit as an argument: > (a -> (b -> (c -> d))) (((f 1) 2) 3) > (((a -> b) -> c) -> d) (f (1 (2 3))) -- brandon s.

Re: [Haskell-cafe] Re: Function Precedence

2008-04-01 Thread PR Stanley
Are you asking why one doesn't change the rules for all functions? Or are you asking why Haskell doesn't include a system of user-defined precedence and associativity for function application so that one could declare that g binds more tightly than f? I see good reasons for both questions, but I

[Haskell-cafe] Re: Function Precedence

2008-04-01 Thread Chris Smith
PR Stanley wrote: >>Should that be f (1 (2 3)), or ((f 1) 2) 3? > The latter, of course, but that's not really what I'm > driving at. I'm asking why we can't have a function treated differently > with regard to the precedence and associativity rules. f 1 2 is indeed > ((f 1) 2). Why not f