Browse thread
[Caml-list] Polymorphic variant abbreviations
[
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: | Patrick M Doane <patrick@w...> |
| Subject: | Re: [Caml-list] Polymorphic variant abbreviations |
On Wed, 19 Sep 2001, Laurent Vibert wrote: > > I was hoping that I could use this: > > > > let f ~a:#a = ... > > you should write : > > let f ~a : #a = ... But then I get a syntax error for the next argument: let f1 ~a : #a ~b : #b = ... Hmm.. try adding parens as usual for type constraints: let f1 (~a : #a) (~b : #b) = ... but still a syntax error. Move the tilde outside, let f1 ~(a : #a) ~(b : #b) = .. This is syntactically valid, but doesn't give the most flexible typing. Finally, last try: let f1 ~a:(#a as a) ~b:(#b as b) = ... produces the correct type: val f1 : a:#a -> b:#b -> ... It would have been nice if I could achieve that with just a ~ like this: let f1 ~a:#a -> ~b:#b Patrick ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr