Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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,
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