[Haskell-cafe] Line noise

Jason Dagit dagit at codersbase.com
Mon Sep 22 21:24:32 EDT 2008


On Mon, Sep 22, 2008 at 6:27 PM, Brian Hurt <bhurt at spnz.org> wrote:
>
>
> On Sun, 21 Sep 2008, wren ng thornton wrote:
>
>> Even with functionalists ---of the OCaml and SML ilk--- this use of spaces
>> can be confusing if noone explains that function application binds tighter
>> than all operators.
>
> Bwuh?  Ocaml programmers certainly know that application binds tighter than
> operators.  And as:
>
>        let f x y = ... in
>        f a b
>
> is more efficient (in Ocaml) than:
>
>        let f (x, y) = ... in
>        f (a, b)
>
> (Ocaml doesn't optimize away the tuple allocation), the former
> (Haskell-like) is generally preferred by Ocaml programmers.

That's odd.  My experience from trying to learn ocaml at one point was
that the tuple notation is preferable because you can do pattern
matching on every value in the tuple whereas with the other one you
can match on either the first or second parameter but not both without
nesting ocaml's version of 'case ... of' (match ... with?).  One of
the things I really like about Haskell syntax is that you can pattern
match on any number of parameters without having to nest 'case ... of'
expressions.

Jason


More information about the Haskell-Cafe mailing list