caml-list - the Caml user's mailing list
 help / Atom feed
From: Jun Furuse <>
Subject: [Caml-announce] G'Caml, Caml with Extensional polymorphism extension
Date: Tue, 19 Jun 2001 18:24:24 +0200
Message-ID: <> (raw)


I'm pleased to announce G'Caml, the experimental extension of
the extensional polymorphism([1],[2]) to O'Caml, available at

You can define non parametric, ad-hoc polymorphic values 
(so called "overloaded" or "generic" functions)
using newly added "generic" bindings. For example:

     # generic plus = case
       | int -> int -> int => (+)
       | float -> float -> float => (+.) 

This defines an ad-hoc polymorphic function plus, which can work
both for integer and float additions.

     # plus 1 2;;
     - : int = 3 

     # plus 1.2 3.4;;
     - : int = 4.6

Not only such overloaded arithmetic functions, we can define 
many interesting ad-hoc polymorphic values which cannot be imagined 
in the normal ML.

G'Caml also provides dynamic values and a toplevel magic printing function,
using the internal framework of extensional polymorphism implementation.

We can encapsulate a value and its type into an object typed dyn.
Then using this encapsulated type information, we can perform
run time type checking:

      # dyn 1;;
      - : dyn = (1 : int) 

      # coerce (dyn 1) with 
        | (x : int) => Printf.printf "It is an int %d.\n" x
	| (x : float) => Printf.printf "It is a float %f.\n" x
      It is an int 1.
      - : unit = () 

The toplevel magic printing is the function which many people have
asked for in this list. It can print out any ML value (well, functions 
are just printed as <fun>), including the constructor names of
user defined types (this is available only in the toplevel):
      # type foo = Foo of int;;
      # Toploop.print (Foo 42);;
      Foo 42- : unit = ()

G'Caml is still quite experimental and under development.
I am sure that there are tons of bugs. 
Do not expect something almost complete, 
like the initial O'Labl release...

I hope you could enjoy it.

"Extensional Polymorphism".
Catherine Dubois, Francois Rouaix, Pierre Weis. 
Proceedings POPL 95.

"Generic polymorphism in ML".
Jun Furuse.
Journees Francophones des Langages Applicatifs 2001

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2001-06-19 17:26 ` Jun Furuse [this message]
2001-06-19 17:38   ` [Caml-list] " Jun Furuse
2001-06-19 17:57   ` Brian Rogoff
     [not found]   ` <>
2001-07-24 18:29     ` Chris Hecker

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror

AGPL code for this site: git clone public-inbox