caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] variant and functor
@ 2003-07-03 16:11 Julien Signoles
  0 siblings, 0 replies; only message in thread
From: Julien Signoles @ 2003-07-03 16:11 UTC (permalink / raw)
  To: caml-list

Hi list,

I have the following functor :

module Make(A : sig type a val f : a -> int end) =
struct
  type t = [ A.a | `B ]
          (* impossible : A.a is abstract and not a variant *)

  let foo = function
    | #A.a as a -> A.f a (* no assumption about the tags of A.a *)
    | `B        -> 0

end

I'd like to know if it is possible to describe A.a as a variant type
without write its tags.

Cheers,
Julien Signoles.
-- 
mailto : Julien.Signoles@lri.fr ; http : www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-03 16:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-03 16:11 [Caml-list] variant and functor Julien Signoles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).