English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Typing of the sequence operator (;)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-11-11 (20:12)
From: Martin Jambon <martin_jambon@e...>
Subject: Re: [Caml-list] Typing of the sequence operator (;)
On Fri, 11 Nov 2005, Lukasz Stafiniak wrote:

> Dear list,
> Why does the sequence operator (;) have type 'a -> 'b -> 'b and not
> unit -> 'a -> 'a? There is (ignore) for doing "these things"
> purposefully. The toplevel warning is very often mute. Together with
> labels, this is a source of bugs.

You can use the Camlp4 pa_ru.cmo module which adds type constraints in 
sequences, and is mentioned there:

So something like that should work:
   ocamlopt -pp 'camlp4o pa_ru.cmo' yourfile.ml


Martin Jambon, PhD - http://martin.jambon.free.fr