Version française
Home     About     Download     Resources     Contact us    
Browse thread
Constructors are not functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] Constructors are not functions
David Allsopp wrote:
> > Is there a reason for constructors not to behave like functions?
> > For instance, one cannot make a partial application from a constructor:
> 
> This is how SML handles constructors, Xavier explained the reasons he
> chose to depart from this in:
> 
> http://caml.inria.fr/pub/ml-archives/caml-
> list/2001/08/47db53a4b42529708647c9e81183598b.en.html
> 
> I think it would be possible to simulate the SML behaviour in OCaml
> using camlp4 (if you assume that for [type foo = Bar of int] that
> future unbound references to [bar] are interpreted as [fun x -> bar x]
> instead of an error)

Tsk - [fun x -> bar x] should of course be [fun x -> Bar x]