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
[Caml-list] Polymorphic variant abbreviations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-18 (22:48)
From: Patrick M Doane <patrick@w...>
Subject: [Caml-list] Polymorphic variant abbreviations
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 = ...

but then it says that 'a' is unbound.

I also find that the error messages are not as useful as they could be
with the type abbreviations. E.g:

  This expression has type ... but is here used with #a as 'a = 'a

Would it be hard to expand '#a' like this so I don't have to track down
the definition? 

  This expression has type ... but is here used with #a = [ `A ]

Thanks for any help or suggestions,

Bug reports:  FAQ:
To unsubscribe, mail  Archives: