[
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: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] Simple(?) subtyping problem... |
Slight variation on Jon's answer: type c = [`B] let c = function | `B -> () let b = function | `A -> () | #c as x -> c x which has exactly the same type as your original b. The way dispatching is typed in caml, you have to indicate explicitly which cases you inherit from c. But it should no hinder extensibility. Jacques Garrigue From: "Till Varoquaux" <till.varoquaux@gmail.com> > I'm currently trying to split functions matching against given variant > type and I'm running across this pb: > > let a= function > | `A -> () > | `B -> () > > doesn't split into > > let c=function > | `B -> () > > let b =function > | `A -> () > | x -> c x > > since it messes up the type rules. I really want to avoid having to > write down precise type informations (The point here is to have an > extensible system)... > > I am sure this question has been asked loads of times (but I couldn't > find the right thread in the archives) and I apologize for asking it > yet again. > > Till