Version française
Home     About     Download     Resources     Contact us    
Browse thread
what do I need to know to understand camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Elias Gabriel Amaral da Silva <tolkiendili@g...>
Subject: Re: [Caml-list] what do I need to know to understand camlp4
2010/9/24 David House <dmhouse@gmail.com>:

> Incidentally, ($) in Haskell is right-associative; however the
> consensus in the Haskell community (in my experience) is that this is
> a mistake. If it were left-associative, you would lose the ability to
> say f $ g $ x, but this can be written f . g $ x anyway (dot is
> function composition (a -> b) -> (b -> c) -> a -> c, and does
> right-associate), but many things would require fewer parentheses,
> e.g. f (g x) (h y) can be written f $ g x $ h y.
>
> In fact, the strict function application operator ($!) *is* left-associative.
>
> See http://hackage.haskell.org/trac/haskell-prime/wiki/ChangeDollarAssociativity
> for more information.

Oops. Still learning the basics of Haskell. Interesting, thanks :)

> Also, you say "Pervasives should define it" -- the important thing
> about dollar in Haskell is that it has very low precedence, hence its
> ability to save parentheses. I didn't think OCaml allowed us to
> specify the operator precedence of the infix operators we define.

Yes, the observation was made after seeing that $ would have lower
precedence than function application itself, but this does not say
anything about precedence in relation to other operators..

-- 
Elias Gabriel Amaral da Silva <tolkiendili@gmail.com>