Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
type -'a obj
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: type -'a obj
I'm trying to decode this type definition in lablgtk:

type -'a obj

The manual says:

Each type parameter may be prefixed by a variance constraint +
(resp. -) indicating that the parameter is covariant
(resp. contravariant). These type parameters can appear in the type
expressions of the right-hand side of the definition, restricted
eventually by a variance constraint ; i.e. a covariant parameter may
only appear on the right side of a functional arrow (more precisely,
follow the left branch of an even number of arrows), and a convariant
parameter only the left side (left branch of an odd number of arrows).

but this leaves me none the wiser about the +/- before the polymorphic
'a. Can someone explain what this means in plain english?



Richard Jones.
Merjis Ltd. - all your business data are belong to you.
"I wish more software used text based configuration files!"
-- A Windows NT user, quoted on Slashdot.