Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] list in functional style
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frank Atanassow <franka@c...>
Subject: Re: [Caml-list] list in functional style
Costin Stefan wrote (on 07-08-01 12:41 +0300):
> I have the following problem : want to define lists but using only
> functions :

Sorry, I was not reading very carefully and now recognize that my post was a
complete non-answer.

> So why the type of the result of hd may be the same of the type of the
> result of tl !
> 
> Why the type of the result of a cons isn't a polymorphic function ?

Type variables of the form '_a are not generalized; they can be instantiated
only once. This is a conservative criterion to ML-like languages use to handle
the interaction between polymorphism and imperative side-effects.

You can read about it in the FAQ:

  http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles

-- 
Frank Atanassow, Information & Computing Sciences, Utrecht University
Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands
Tel +31 (030) 253-3261 Fax +31 (030) 251-379
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr