[PRL] first-class polymorphic values

Carl Eastlund cce at ccs.neu.edu
Sun Feb 25 11:00:28 EST 2007


On 2/25/07, Dave Herman <dherman at ccs.neu.edu> wrote:
> I know that FX supported first-class polymorphic values, and O'Toole and
> Gifford have a PLDI'89 paper on supporting type inference in languages
> with polymorphic values. Does anyone know of other languages that have
> allowed first-class polymorphic values?

OCaml allows record types (which must be declared) to have polymorphic
field types.  So you can declare:

type map = { map : 'a 'b . ('a -> 'b) -> 'a list -> 'b list }

This creates a record type with a single field "map" which must
contain a polymorphic function (matching the well-known signature for
List.map).  They get away with this because record types and record
field names must be declared and unique (so for instance, no other
record type in scope can have a field called "map").  OCaml
essentially did away with type inference for its records.

-- 
Carl Eastlund



More information about the PRL mailing list