can come to understand that an
explicit return type overrides this.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http
#add ~markup:span
foreground=\red\Hello/span ()
Jacques Garrigue
On 2010/11/29, at 22:20, Daniel de Rauglaudre wrote:
Hi,
I'd like to have a label widget in Lablgtk with a string with
internationalization, bold, italic, utf8, color, things like that.
I am not sure, but I saw in the Web
).
The obvious alternative to lablgtk2 is of course labltk.
I personally think that labltk is still the easiest way to build a GUI,
but many do not like Tk's lookfeel.
I'm not aware of other GUI toolkits for ocaml, but I think there are also
web-based UIs.
Jacques Garrigue
On Tue, Nov 23, 2010
( @@ ) : ('a - 'b) - 'a - 'b = fun
# succ @@ succ @@ succ 3;;
- : int = 6
Note however that there is a simpler way to circumvent the problem:
use the -w s option on the command line, disabling the statement warning.
All my lablgtk code uses this flag :-)
Jacques Garrigue
that this is rather verbose.
I thought a few times of adding the syntax you propose, but was always
stopped by the fact you can already do it in a verbose way.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman
of existential
variables
to be explicit. I.e. one could write
App of 'a. ('a - 'b) t * 'a t : 'b t
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
of corruption.
When in doubt, it is always safer to use CAMLparam/CAMLreturn, eventhough they
will
generate a bit more code.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
On 2010/10/09, at 2:13, Sylvain Le Gall wrote:
Hello all,
I would like to build an interface for plugins that allow to extract at the
same time a very specific data for a plugin family and to extract
general help for plugins.
Here is an example:
[...]
This code doesn't compile because
You were looking in the wrong place.
The official lablgtk distribution is at
wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html
Since 2.14.2 as just been released, and there has been no change in the trunk
since then, the daily snapshots are also ok.
Jacques
-
From: Jianzhou Zhao
-expansion approach might
introduce a discrepancy, you will get a type error.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list
, the error message is not very explicit about the cause.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http
Thanks for the report.
This is fixed now.
Jacques Garrigue
-
From: JérémieDimino jere...@dimino.org
The link to download the tarball seems to be broken: it ends with
lablgtk-2.14.2.gz instead of lablgtk-2.14.2.tar.gz
On Fri, Sep 17, 2010 at 05:59:19PM +0900, Jacques Garrigue wrote:
Dear
to write:
module Unit = struct end
module C(FreshGram : functor(Unit : sig end) - Camlp4Syntax) : Camlp4Syntax =
Printers_Ocaml_Make(FreshGram(Unit))
Hope this helps.
Jacques Garrigue
As the names suggest the problem came up with in some Camlp4
code. Here is a striped down version
, but not Hendrik's, because his example
requires applicative functor to start with.
Jacques Garrigue
[Your 2 other versions]
module A : sig
type m
module M : sig
type t = m
end
end = struct
module S = String
module M = struct
module Smap = Map.Make(S)
type t = int
into a function returning a signature.
Hope this helps,
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com
On 2010/07/22, at 18:37, rossb...@mpi-sws.org wrote:
Jacques Garrigue garri...@math.nagoya-u.ac.jp wrote:
module type MyModuleType(Param:ParamType) = sig ... end
But this just doesn't make sense.
Hm, I would disagree. It makes perfect sense, it just wouldn't desugar in
the way Dumitru
representations...
Jacques Garrigue
On Tue, Jun 8, 2010 at 8:40 PM, bluestorm bluestorm.d...@gmail.com wrote:
You're right : that's true in the int case and I hadn't considered it.
But if you use the same trick for ('a - float) or other types you can get a
segfault :
# external floatify
From: Kaustuv Chaudhuri kaustuv.chaudh...@inria.fr
On Tue, Jun 8, 2010 at 4:37 PM, Jacques Garrigue
garri...@math.nagoya-u.ac.jp wrote:
Of course intify can cause a segmentation fault!
# let arr = Array.of_list [intify 1.0; 0];;
Segmentation fault
This may be splitting hairs
with the other aproach, so I'm
not sure that it matters that much.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http
natural.)
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http
that tuareg mode switch to the ocaml-mode
code base, because I think that actually the tuareg code is cleaner.
However, for various historical reasons the two code bases are
developped in parallel, with some reasonable amount of sharing, so
I see no real problem with the current situation.
Jacques
bar = object val mutable foo : foo list end
end = M
class bar : M.bar = object val mutable foo : M.foo list = [] end
You still need to provide an explicit interface for bar.
Hope this helps,
Jacques Garrigue
___
Caml-list mailing list. Subscription
The windows release has not been updated at this time.
---
Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp
A HREF=http://www.math.nagoya-u.ac.jp/~garrigue/JG
the outside, while abbreviations just have to be
expanded.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group
= r tf
let r2 = r tf
let r3 = r ts
let test12 = assert (r1 = r2) (* fail = r1 ≠ r2 *)
let test13 = assert (r1 = r3) (* fail = r1 ≠ r3 *)
(* Conclusion: RHS evaluated exactly at the point of mapping application *)
Sure, this is an eager language.
Jacques Garrigue
as the implementation.
In your case, you should simply write
type t = [`a | `b]
since you don't know what v may be.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http
From: Philippe Veber philippe.ve...@googlemail.com
2010/5/14 Jacques Garrigue garri...@math.nagoya-u.ac.jp
From: Philippe Veber philippe.ve...@googlemail.com
I'd like to define a type with a variable that is constrained to accept
only
polymorphic variant types included in a given set
itself *)
module type EdgeX' = module type of EdgeX
module Algorithm(EdgeX : EdgeX) = struct let doit = EdgeX.foo end
Hope this helps,
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml
such differential types, poinder the problem: what is the type of
transform composed with itself.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
is 243, so that names of no more than 4 characters are
guaranteed to be different. You still have collisions, but they are
going to be less similar.
Both hash functions are defined in byterun/hash.c.
Hope this helps,
Jacques Garrigue
___
Caml-list
from uniqueness
types.
Cheers,
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug
!r ()
The language is just too expressive...
You should rather look into adding a dynamic flag to your context,
causing a runtime error if you use it later.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi
to unroll it by hand:
type ('a, 'b) t = [ `A of 'a | `T of [ `A of 'b | `T of ('a,'b) t]];;
(I added an argument to `A to make the parameters meaningful.)
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin
(IntList.Cons (1, IntList.Nil));;
Again, these two definitions of list, while representing the same data,
are incompatible.
Hope this helps.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman
.
---
Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp
A HREF=http://www.math.nagoya-u.ac.jp/~garrigue/JG/A
___
Caml-list mailing list. Subscription
First, like everybody else, I'd like very much to try this out.
Is there any chance it could compile on Snow Leopard :-)
(I suppose it's near impossible, but still ask...)
From: Jon Harrop j...@ffconsultancy.com
Visual Basic has been a *lot* faster than OCaml for several years now, not
least
to types
in camlp4. Implementing it requires lots of changes to the type
inference itself.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
inference, and
suddenly break your program.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group
doubly linked lists has only a very
limited cost, mostly related to the extra space needed.
By the way, BSD uses lots of singly-linked lists, probably because it
comes from a time when there was not so much memory.
Jacques Garrigue
___
Caml-list mailing
).
Jacques Garrigue
On Wed, Jul 29, 2009 at 3:40 AM, Mark
Shinwellmshinw...@janestcapital.com wrote:
On Tue, Jul 28, 2009 at 05:47:25PM -0400, Aaron Bohannon wrote:
Why do the first two programs type-check but the thrid one does not?
Dark corners of the type system.
let f (x : 'a) : 'a = x in (f
. But whether it
matters or not depends much on what you use them for in your program.
Jacques Garrigue
(*
To compile:
ocamlc -I +camlp4 -c -pp camlp4orf pa_polymap.ml
ocamlc -c polymap.ml
To use:
ocaml dynlink.cma camlp4o.cma pa_polymap.cmo polymap.cmo
or
ocamlc -pp
is the size taken by y.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug
) =
object
val x = n
method get_x = x
method print = print_int x
end
let create = new test
let equal t1 t2 = t1#get_x = t2#get_x
end
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin
.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin
the definitions are
mutually recursive, and do not go through any datatype definition.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list
://www.pllab.riec.tohoku.ac.jp/smlsharp/
# fun f x = #name x;
val f = fn : ['a, 'b#{name:'a}. 'b - 'a]
# f {name = Joe, age = 21};
val it = Joe : string
But the compiler is rather clever...
Jacques Garrigue
___
Caml-list mailing list. Subscription management
From: Radzevich Belevich radzevich.belev...@gmail.com
class [ 'c ] a =
object(self)
constraint 'c = ..
method as_c = (self : 'c)
method id = Oo.id self
end ;;
class ['a] a :
object ('a)
constraint 'a = as_c : 'a; id : int; ..
(fun w - w.base {bop = fun r - r.fn r.x}) l
As you can see, the result is rather verbose, but this works.
Fortunately, closure and objects are usually enough...
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr
universality is checked, to ensure that no cross application
can be done.
Jacques Garrigue
Then what you are asking for is existential types. There is no syntax
for them in ocaml, but they can be encoded through universal types
(interestingly, the dual is not true).
type 'a base = {x : 'a; fn
/'a] represents substitution. In other words, b has one more
constructor than a. Is a always a subtype of b?
Yes, but only if 'a appears only in covariant positions inside
t1...tn. And you will need double coercions (i.e. coercions with
explicit source and target types) to enforce this subtyping.
Jacques
, but then you can't access it after
inheritance), or to use a private method. What is your problem with a
private method? It should be more flexible.
Of course you can also define a record to wrap your polymorphic value.
Jacques Garrigue
___
Caml-list
to use the second
without the first.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group
order, and I don't see
why it should change, but if your code depends on such things it may
always be a good idea to put somewhere a bit of code that verifies
that the behaviour is correct.
Jacques Garrigue
___
Caml-list mailing list. Subscription
of the problem you reported in your previous mail.
There is however a real type error, because Node.t, as it has a
private row, cannot be an instance of the fixed type elem_t.
Cheers,
Jacques Garrigue
___
Caml-list mailing list. Subscription management
From: Dario Teixeira darioteixe...@yahoo.com
I ditched the regular variants in favour of polymorphic variants, hoping
the coercion trick described by Jacques Garrigue would help [1]. I've also
simplified the formulation as much as possible. Anyway, I'm still stuck
with the same problem
hope this gives you some ideas on how to proceed.
Cheers,
Jacques Garrigue
module Node: sig
type +'a t = private
| Text of string
| Bold of 'a t list
| Href of string
| Mref of string * [`Nonlink] t list
val text: string - [ `Nonlink ] t
val bold: 'a t list - 'a t
val
both `Link and `Nonlink in
input. This would not be necessary if I had written
Mref of string * 'a t list in the definition, rather than
Mref of string * [`Nonlink] t list like I did. But being more
specific also means that you have more information when you unwrap an
Mref node.
Cheers,
Jacques
classes for polymorphic variants, without introducing conflicts.
I'm afraid the combination of type classes with modules and functors
is not trivial either.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin
From: Jacques Carette care...@mcmaster.ca
Subject: [Caml-list] Debugging the compiler
Date: Sat, 27 Dec 2008 10:24:52 -0500
Nothing like the holidays for a little playing around with some ideas by
modifying a compiler... Having got the hang of bootstrapping the
compiler [with help from old
everywhere subtyping is needed.
You can also compare that to the situation between int and float.
For most uses, int can be viewed as a subtype of float. However ocaml
separates the two, and requires coercion functions whenever you want
to use an int as a float.
Cheers,
Jacques Garrigue
Using labels makes this kind of code more readable.
open StdLabels
let x = List.map my_list ~f:
begin fun z -
very_blabla
end in
...
Jacques Garrigue
From: DooMeeR [EMAIL PROTECTED]
Another possibility is:
let x = List.map begin fun z -
very_blabla
end my_list
Hi Jun,
If it's a bug, it should go to mantis... but it's not one.
From: Jun Furuse [EMAIL PROTECTED]
I found a strange bug in 3.11.0 beta 1. The following typical example
of phantom types does not compile any more. (It is compilable in
3.10.2, but not in release311):
module M : sig
lablgtk programs under FreeBSD is
very slow (1mn). I know how to fix it in the ocaml compiler, but this
rather looks like a FreeBSD bug.
Cheers,
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman
invalid_arg Item.create
end
# Item.create 3 9.95;;
- : Item.item = Item.Item (3, 9.95)
# Item.create 3 (-1.0);;
Exception: Invalid_argument Item.create.
Note that you must imperatively use Item.create to create an item, but
you can use pattern-matching as usual to access its contents.
Jacques
using #fold and
cons:
let map cons f (o : 'a #foldable) =
o#fold (fun x o' - cons (f x) o')
Note that for this to work you need #fold to be the correct fold
(i.e. fold_right)
Hope this helps,
Jacques Garrigue
___
Caml-list mailing list. Subscription
From: Jacques Carette [EMAIL PROTECTED]
Jacques Garrigue wrote:
The message is maybe not clear enough: for pattern-matching and
inheritance, you need an exact variant type, i.e. a type whose lower
and upper bounds are identical.
Indeed - I would suggest that the error include some clearer
, you need an exact variant type, i.e. a type whose lower
and upper bounds are identical. This is clearly not the case for
c. The standard workaround is to write:
type c0 = [a | b]
type 'a c = 'a constraint 'a = [ c0]
Jacques Garrigue
___
Caml-list
expansions are cached, but this needs more investigating.
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group
:-)
Cheers,
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http
(with of course a different semantics).
If you need the private row semantics, you should now write it as
type (+a, 'b) t = private [ super_node_t] as 'a
which is more intuitive anyway.
Jacques Garrigue
___
Caml-list mailing list. Subscription management
From: Jeremy Yallop [EMAIL PROTECTED]
Jacques Garrigue wrote:
From: Jeremy Yallop [EMAIL PROTECTED]
Dario Teixeira wrote:
type ('a, 'b) t = private 'a constraint 'a = [ super_node_t ]
I don't think this is quite what you want yet, although it's getting
close!
The first problem
. Functors would be syntactically nicer,
but they wouldn't let you infer the type of w, which is the whole
point. If getting data out of tuples proves to be a pain, you could
also return an immediate object.
Cheers,
Jacques Garrigue
___
Caml-list mailing list
relevant (but only when there is a bug!)
Jacques Garrigue
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group
by giving
explicitly a module signature (this is what ocamlc does internally).
This is now fixed in CVS, branch release310.
Note that you may still have other kinds of problems using
upper-bounded polymorpic variants inside constraints. Just report them
as you go...
Cheers,
Jacques Garrigue
a method's type with method override.
So get_right_sibling in typ has still type [node option], which means
that in foo_typ, ['p foo_typ] should be a [node option], hence the
contradiction.
There was a type-checker bug in 3.09.2, but it is now fixed.
Cheers,
Jacques Garrigue
75 matches
Mail list logo