caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] getting the type of a polymorphic data ?
       [not found] <20040812143443.2aba80c1@babasse>
@ 2004-08-12 12:47 ` Diego Olivier Fernandez Pons
  2004-08-12 13:11   ` [Caml-list] Compiling on windows (mingw) Daan Leijen
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Olivier Fernandez Pons @ 2004-08-12 12:47 UTC (permalink / raw)
  To: caml-list

    Bonjour

[Je poste la réponse à une question qui m'a été posée en dehors de la
liste car mes explications semblent ne pas avoir été claires]

> mal compris ton problème -- pourquoi ne pas définir un type du genre :
>
> type number = Int of int | Float of float
>
> et faire un matching qui ressemblerait à
>
> let x' = match x with
>          | Int x -> IntSet.from_poly x
>          | Float x -> FloatIntervalSet.from_poly x


Parce que ce n'est pas moi qui définit x. En fait (voir message
initial) x est un ensemble de type polymorphe car l'utilisateur est
supposé pouvoir y mettre ses propres types.

Voici la situation que je veux _éviter_ (exemple tiré de FaCiLe -
Pascal Brisset et Nicolas Barnier)

let
  yellow = 0 and
  blue = 1 and
  green = 2
in
  let x = IntDomain.from_list [0; 1; 2]

A la place je veux

type color = Yellow | Blue | Green

let x = Domain.from_list [Yellow ; Blue; Green]

Mais il faut que la partie interne de la librairie, elle, manipule un
ensemble d'entiers (pour des questions de performance puisqu'il s'agit
d'optimisation combinatoire).

D'où l'idée simple

let x = Domain.from_list [(hash Yellow) ; (hash Blue) ; (hash Green)]

ou encore

let x = Domain.from_list_hashed [ Yellow ; Blue ; Green]


Mais pour que cette optimisation soit correcte, il faut que hash x =
hash y => x = y, d'où ma question.

Autre précision, ce n'est pas grave si un type est isomorphe à un
entier mais le compilateur ne le voit pas par exemple

type x = A of int

Obj.is_int (A 1)
# false


        Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* [Caml-list] Compiling on windows (mingw)
  2004-08-12 12:47 ` [Caml-list] getting the type of a polymorphic data ? Diego Olivier Fernandez Pons
@ 2004-08-12 13:11   ` Daan Leijen
  2004-08-12 13:22     ` Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Daan Leijen @ 2004-08-12 13:11 UTC (permalink / raw)
  To: caml-list

Hi all,

I am trying to compile the glorious ocaml compiler from source on
windowsXP using mingw32 (and cygwin tools). However when I try to
compile ocamlopt, the build fails on the "ar" utility:

 > make -f Makefile.nt opt

[snip]

../boot/ocamlrun ../ocamlopt -a -o stdlib.cmxa pervasives.cmx array.cmx 
list.cmx
  char.cmx string.cmx sys.cmx hashtbl.cmx sort.cmx marshal.cmx obj.cmx 
int32.cmx
int64.cmx nativeint.cmx lexing.cmx parsing.cmx set.cmx map.cmx stack.cmx 
queue.c
mx stream.cmx buffer.cmx printf.cmx format.cmx scanf.cmx arg.cmx 
printexc.cmx gc
.cmx digest.cmx random.cmx callback.cmx camlinternalOO.cmx oo.cmx 
genlex.cmx wea
k.cmx lazy.cmx filename.cmx complex.cmx arrayLabels.cmx listLabels.cmx 
stringLab
els.cmx moreLabels.cmx stdLabels.cmx
ar: @c:\DOCUME~1\Daan\LOCALS~1\Temp\camlresp025be4: Invalid argument
Error while creating the library stdlib.a

[snip]

Maybe someone else on this list has experienced this problem too?

Thanks for the help,
All the best,
  Daan Leijen.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] Compiling on windows (mingw)
  2004-08-12 13:11   ` [Caml-list] Compiling on windows (mingw) Daan Leijen
@ 2004-08-12 13:22     ` Xavier Leroy
  2004-08-12 13:35       ` Daan Leijen
  0 siblings, 1 reply; 4+ messages in thread
From: Xavier Leroy @ 2004-08-12 13:22 UTC (permalink / raw)
  To: Daan Leijen; +Cc: caml-list

Hi Daan,

> I am trying to compile the glorious ocaml compiler from source on
> windowsXP using mingw32 (and cygwin tools). However when I try to
> compile ocamlopt, the build fails on the "ar" utility:
> ar: @c:\DOCUME~1\Daan\LOCALS~1\Temp\camlresp025be4: Invalid argument
> Maybe someone else on this list has experienced this problem too?

I suspect the wrong "ar" is called.  It should be the "ar" that comes
with Cygwin, and not the one that comes with the standalone Mingw
distribution.  The latter doesn't handle long command lines via
"response files".

More generally, the installation instructions weren't too clear on
this but I tried to clarify them in 3.08: the "mingw" port of OCaml
should be built with Cygwin and the Mingw stuff distributed along with
Cygwin, but not with the standalone Mingw32 distribution.  It's all
very confusing, I know...

Hope this helps,

- Xavier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] Compiling on windows (mingw)
  2004-08-12 13:22     ` Xavier Leroy
@ 2004-08-12 13:35       ` Daan Leijen
  0 siblings, 0 replies; 4+ messages in thread
From: Daan Leijen @ 2004-08-12 13:35 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

Xavier Leroy wrote:

> I suspect the wrong "ar" is called.  It should be the "ar" that comes
> with Cygwin, and not the one that comes with the standalone Mingw
> distribution.  The latter doesn't handle long command lines via
> "response files".

That must be it! -- I use indeed the standalone mingw toolset. Thanks
for pointing this out, I was already in despair trying to find the
cause of the bug :-)

I will try to change my setup to use the default cygwin tools.

Thanks for your prompt response,
All the best,
   Daan Leijen.

ps. Would there be a workaround? wxHaskell needs the standalone
mingw toolset to avoid link errors with ghc -- so it is not so
convenient for me to switch between toolsets.


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2004-08-12 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20040812143443.2aba80c1@babasse>
2004-08-12 12:47 ` [Caml-list] getting the type of a polymorphic data ? Diego Olivier Fernandez Pons
2004-08-12 13:11   ` [Caml-list] Compiling on windows (mingw) Daan Leijen
2004-08-12 13:22     ` Xavier Leroy
2004-08-12 13:35       ` Daan Leijen

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