Version française
Home     About     Download     Resources     Contact us    
Browse thread
List.cons and "::"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris King <colanderman@g...>
Subject: Re: [Caml-list] List.cons and "::"
On 7/17/07, Brian Hurt <bhurt@janestcapital.com> wrote:
> I wouldn't recommend it, but you could.
> :: and , you can't override.

Actually,

# type foo = :: of int * int;;
# 1 :: 2;;
- : foo = :: (1, 2)

:)  This is because :: is considered a constructor, and not just
syntax (as is , or []).

But in general automatic currying of constructors would be nice (I
think Haskell does this).  There is probably some technical reason why
it's not a good idea in O'Caml though.

- Chris