caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ML GMP new version
@ 2002-01-01 21:21 David Monniaux
       [not found] ` <AAEBJHFJOIPMMIILCEPBKEGPDGAA.mattias.waldau@abc.se>
  0 siblings, 1 reply; 2+ messages in thread
From: David Monniaux @ 2002-01-01 21:21 UTC (permalink / raw)
  To: caml

[Résumé en français: nouvelle version de ML GMP, interface avec GNU MP
http://www.di.ens.fr/~monniaux/download/mlgmp-20020101.tar.gz]

It is my pleasure to announce the new year's day release of ML GMP, the
library interfacing Objective Caml with GNU MP.

It is a complete rewrite of the earlier versions, which should fix some
tricky garbage collection problems reported by some users.

It features:
* Support for mpz (integers), mpq (rationals), mpf (floating-point), and,
optionally, mpfr if compiled with the MPFR extension library
(www.mpfr.org), which should anyway be integrated into future GNU MP
releases after copyright transfer questions are settled.

* Support for random functions.

* Serialization (hashes will be implemented in the future).

It supports GMP 3.1.1 (and 4.0, but the newer functions are not
supported), MPFR 2001 and 2001-10-26, OCaml 3.02 and 3.04.

It is mostly source-compatible with earlier releases.

http://www.di.ens.fr/~monniaux/download/mlgmp-20020101.tar.gz

The license is LGPL with a special exemption for static linking with an
application (same as the OCaml library).

It ships with an updated copy of J.C. Filliatre's Creal package.


David Monniaux            http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France


-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Caml-list] Re: Phantom types (again) [Novice compilation problem]
       [not found] ` <AAEBJHFJOIPMMIILCEPBKEGPDGAA.mattias.waldau@abc.se>
@ 2002-01-03  0:17   ` Jacques Garrigue
  0 siblings, 0 replies; 2+ messages in thread
From: Jacques Garrigue @ 2002-01-03  0:17 UTC (permalink / raw)
  To: mattias.waldau; +Cc: caml-list

Hello,

You have an interesting point here. When using phantom types, in some
cases it is not enough to put type annotations in the signature, since
they must appear before any meaningful use of the phantom.

Here what happens is that you are using "before" and "happen" as fully
polymorphic functions inside "illegal" (which is legal), and only
later force them to have more specific types.
Note that module M : Sig = Struct is (AFAIK) equivalent to
defining first module M0 = Struct and then module M : Sig = M0. That
is, constraints in the interface have no effect whatsoever on the
type checking done inside the structure.

Remark also that if you define your module and interface (without
illegal) first, and try later to define illegal outside of the module,
then you will properly fail: the constraints are now active.

Cheers,

Jacques Garrigue

From: "Mattias Waldau" <mattias.waldau@abc.se>
>
> I was looking at phantom types again and realized that I could use 
> them to get rid of a lot of ' | _ -> assert false ' in my code.
> 
> However, I have to put the typing into the header of the actual 
> code in the ML-file to get it to work.
> 
> Why doesn't the type checking of 'illegal' fail when I split it 
> into sig+struct or into mli+ml? 
> 
> Below, you first see my original program (with 'assert false'),
> and then 2 phantom-type versions. The last one compiles and complains
> as expected.
> 
> /mattias
> 
> Even if I used Ocaml a lot for a year now, I haven't really seen
> why I should use signatures or MLI-files. I do application 
> development, and rarely define new signatures. I think they 
> are mostly needed when you define general data structures. 
> Compile times are good enough, so I don't need mli-files for
> that. Making types abstract makes it harder to test and debug 
> since you cannot see them the values in the debugger or on the 
> toplevel. A pointer to a discussion on "Why you should use
> signatures" would be appreciated.
> 
> 
> (* The old code that I am replacing using phantom types
> 
> type flag_t = Before | After ;;
> 
> type t = 
>     One of string * flag_t
>   | Two of string * flag_t ;;
> 
> let before x = 
>   match x with
>   | One( str, Before ) -> ()
>   | Two( str, Before ) -> ()
>   | _ -> assert false ;;
> 
> let transform x =
>   match x with
>   | One( str, Before ) -> One( str, After )
>   | Two( str, Before ) -> Two( str, After )
>   | _ -> assert false ;;
>     
> let after x =
>   match x with
>   | One( str, After ) -> ()
>   | Two( str, After ) -> ()
>   | _ -> assert false ;;
> 
> 
> let main x =
>   before x;
>   after (transform x) ;;
> 
> 
> let _ = main (One ("foo", Before)) ;;
> *)
> 
> (* But why doesn't splitting the phantom code 
> into mli+ml generate a compile error for illegal????
-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-03  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-01 21:21 [Caml-list] ML GMP new version David Monniaux
     [not found] ` <AAEBJHFJOIPMMIILCEPBKEGPDGAA.mattias.waldau@abc.se>
2002-01-03  0:17   ` [Caml-list] Re: Phantom types (again) [Novice compilation problem] Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).