Browse thread
Constructed types
- Chris Keane
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Chris Keane <Chris.Keane@c...> |
| Subject: | Constructed types |
If this works as it should:
> Objective Caml version 2.00
>
> # type foo =
> Bar of int * int;;
> type foo = | Bar of int * int
> # let myfun x =
> let (m,n) = if x = 0 then (0,0) else (1,1) in
> Bar (m,n);;
> val myfun : int -> foo = <fun>
then why doesn't this?
> # let myfun2 x =
> let m = if x = 0 then (0,0) else (1,1) in
> Bar m;;
> The constructor Bar expects 2 argument(s),
> but is here applied to 1 argument(s)
or even this?
> # let myfun3 x =
> Bar (if x = 0 then (0,0) else (1,1));;
> The constructor Bar expects 2 argument(s),
> but is here applied to 1 argument(s)
Thanks,
Chris.
------------------------------------------------------------------- ><> ---
Hardware Compilation Group, Oxford University Computing Laboratory,
Wolfson Building, Parks Road, Oxford, OX1 3QD, U.K.
tel: +44 (1865) (2)73865 e-mail: Chris.Keane@comlab.ox.ac.uk
http://www.comlab.ox.ac.uk/oucl/users/chris.keane/