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
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-17 (00:47)
From: Alessandro Baretta <alex@b...>
Subject: [Caml-list] Re: how to start

climb wrote:
> Dear caml-list
>  i am a new commer of Caml language.

Welcome on board!

> and start with online mannul
>  i am confused at this sentence in Chapter 1
> # type idref={ mutable id : 'a. 'a -> 'a};;
> what does "." mean?

'a. 'a -> 'a

This is read as: "For every type 'a, a function from 'a to
'a". In this context 'a is a type variable. The type
variable preceding the "." are "universally quantified":
this is where the "For every type ..." comes into the game.

This basically states that the type of id is polymorphic: 'a
-> 'a  is a type schema as opposed to a specific type. Many
different types fit this schema:
int -> int
string -> string
(int -> int) -> (int -> int), and so on.

The type schema 'a. 'a -> 'a is entirely equivalent to the
axiom schema of propositional calculus A => A: "If A then
A." A stands for *any* proposition, not for any one specific

> why i can not write 
> # type intidref= { mutable id : int. int->int};;

This does not make sense because "int" is a type value and
not a type variable.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: