Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2009-10-06 (12:01)
From: Chantal KELLER <chantal.keller@w...>
Subject: Constructors are not functions
    Dear Ocaml users,

  Is there a reason for constructors not to behave like functions? For
instance, one cannot make a partial application from a constructor:

# type foo = | Bar of int;;
type foo = Bar of int
# let foobar = Bar in foobar 17;;
Error: The constructor Bar expects 1 argument(s),
       but is applied here to 0 argument(s)

Chantal KELLER