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: | Laurent Vibert <lvibert@i...> |
| Subject: | Re: [Caml-list] Polymorphic variant abbreviations |
On Tue, 18 Sep 2001, Patrick M Doane wrote: > I have some code that would like to use polymorphic type abbreviations > along with labels. It seems to be not behaving quite like I expected. > What could I do to make this shorter: > > type a = [ `A ] > > let f ~a:(#a as a) = ... > > I was hoping that I could use this: > > let f ~a:#a = ... you should write : let f ~a : #a = ... the problem is that #a is both a type expression and a pattern, and in your expression, it's a pattern. For example if you write : let f ~a:int = int the int is not a type expression ! ------------------- 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