Thanks for the good work!
Just a remark: I have sometimes considered sending a bug report for
findlib (actually each time the bug was in another place), and did not
know where to send them. On the (otherwise excellently polished)
camlcity wepages there is never any mention of a bug reporting
Now I want to design a module Q, with operations using type t. To refer to t
in
the signature of Q, I am obliged to declare a module Mt : MT inside the
signature
module type QT = sig
module Mt : MT
val g : Mt.t -
end
I don't believe this is the way to go. You could either:
1.
-...@web.de wrote:
Gabriel Scherer gabriel.sche...@gmail.com writes:
You need to specify in the signature that ('a t) is contravariant:
type +'a t
Thanks, that was what I was looking for. Why can I never find this in
the docs when I need it? :)
MfG
Goswin
--
Caml-list mailing list
Is it possible to somehow declare the constraint that 'a in 'a shallow
must not be itself a 'b shallow?
If I understand correctly, this is not possible directly, and while
you could do that with a sufficiently clever layer of phantom types,
I'm not sure it is worth the additional complexity. In
You need to specify in the signature that ('a t) is contravariant:
type +'a t
This is done to please the relaxed value restriction: in the
let-binding let foo = make_null (), the right-hand-side is not a
value, so it is not generalized (this is the value restriction). The
relaxation introduced
Thanks for the clearer use-case example.
I think Andreas's comment is at a general level of language design:
no, we don't want to add something close to what you're asking for in
a language. His argumentation is spot on. What we could have is a type
system with strong update, but that's dreaming
Module.(foo (op) bar)
This is a local open (a more explicit notation is let open Module in
foo op bar). I think this is a fine solution: I don't like open, but
local mitigates its flaws.
Another solution is to rebind your operator locally:
let (op) = Module.blah in
foo op bar
(of course
It seems Printexc.register_printer affects the other Printexc.*
functions, not the way the toplevel itself (or the runtime system more
generally) handles uncaught exceptions.
# Printexc.register_printer begin function Not_found - Some hello |
_ - None end;;
- : unit = ()
# (fun () - raise
Dear list, I'm afraid my last e-mail was rejected because it was too
long. This is probably a good indication that it would be too long for
you as well, but for the record I have uploaded the email content and
the attached technical development:
Is there a description somewhere of the semantics of your language change?
More specifically:
1. You link to a paper by Andres Löh and Ralf Hinze, how close are you
of their proposal?
They mention open datatypes and functions, you propose open datatypes,
but not open functions? That would be
In the next OCaml version, you will be able to do that more cleanly with GADTs.
That is actually one of the advantages of having GADTs in the
language; while the typing effects can be (more or less awkwardly)
encoded in existing constructions, such encodings tends to rely on
higher-order
In the ML-type-system community, enforcing invariant through typing
has mostly been discussed, as far as I'm aware, informally, and is
part of the language communities folklore. There have been
publications centered on the use of richer features (than the base ML
type systems), with examples that
May your program leak one of those GTK resources?
The effectiveness of your patch seems to indicate that you have a lot
of one of these values allocated (and that they were requesting the GC
much too frequently). The patch solves the CPU usage induced by
additional GC, but does not change the
A small implementation of a FIFO queue implemented as a circular
buffer of fixed length:
type 'a circular_buffer = {
mutable pos : int;
mutable count : int;
data : 'a array;
size : int;
}
let create size dummy = {
pos = 0;
count = 0;
data = Array.make size dummy;
size;
}
let
I suppose the bugtracker is a good choice, as long as you set the
category (Caml web site or OCaml documentation according to
whether it's part of a full-blown document or about the website
navigation) and severity (text) accordingly.
On Wed, Mar 28, 2012 at 1:53 PM, Ricardo Catalinas Jiménez
the polymorphism
for polymorphic recursion.)
On Fri, Mar 23, 2012 at 7:45 AM, Jacques Garrigue
garri...@math.nagoya-u.ac.jp wrote:
On 2012/03/23, at 14:52, Gabriel Scherer wrote:
However, as you already mentioned, the original type itself was erroneous.
So a better solution would be to get an error
Aurochs is still available on Berke Durak's github:
https://github.com/berke/aurochs
Aurochs is only a parser generator; it was used to write a Javascript
grammar for the tool Jsure (also developped by Berke):
https://github.com/berke/jsure
On Thu, Mar 22, 2012 at 12:34 PM, Alan Schmitt
This is a consequence of value restriction, with a direct workaround.
See the FAQ:
A function obtained through partial application is not polymorphic enough
http://caml.inria.fr/resources/doc/faq/core.en.html#eta-expansion
let get1 a b =
let must x = lmust get2 x in
On Fri,
However, as you already mentioned, the original type itself was erroneous.
So a better solution would be to get an error at that point.
Namely, if the type annotation contains a type variable with the same name
as one of the quantified types.
Does it sound reasonable.
I'd rather use a
I suspect you're seeing too much into the GADT as they're being added
in OCaml. Your examples are not basically about GADTs, but about
dependent types: you want to encode values (and operations on them) at
the type level to get more expressivity. This is a well-known and
extremely powerful trend
:-(
I don't understand. Why is it sad to have the *ability* to perform
cross-module implementation-dependent optimizations (at the inevitable
cost of locally damaging separate compilation) *if* you wish?
On Wed, Mar 14, 2012 at 11:31 AM, Matej Košík
5764c029b688c1c0d24a2e97cd7...@gmail.com
Here is a proposal:
https://gitorious.org/gasche-snippets/private-array-keys-type/blobs/master/private_array_key_types.ml
It works by using a functor to generate fresh private types for
keys. Note that the arrays themselves are still polymorphic (no
IntArray FloatArray etc.). The user still
I can't comment on the type-checker internals, but a general first
step would be to make sure that you don't recompile things that you
don't need to.
If you change the *implementation* of a module without changing its
interface, you should not have to recompile any other module, at least
when
think learning *not to use* fancy features is just as fun as using them.
On Fri, Mar 9, 2012 at 8:50 AM, Goswin von Brederlow goswin-...@web.de wrote:
Gabriel Scherer gabriel.sche...@gmail.com writes:
I have implemented a small example in two versions: one with external
dllist (I'm using
:
https://gitorious.org/gasche-snippets/outside-or-inline-lists/blobs/master/goswin_dllists.ml
On Thu, Mar 8, 2012 at 6:11 AM, Goswin von Brederlow goswin-...@web.de wrote:
Gabriel Scherer gabriel.sche...@gmail.com writes:
So then you need mutable option types or mutables that you initialize
This error is not Mac-related (I can reproduce it on my Debian).
I believe it is a result from the link-by-need semantics of the .cma
and .cmxa: loader.ml does not explicitly depend on test, so when
producing the executable test.cmxa isn't linked (modules included
.cm{x,}a, contrarily to .cm{x,o},
You can inject the definition you want in the following way:
module Meths = struct
include Meths
module Show_t = ...
end
type value_kind = ...
deriving (Show)
This works because deriving, being a Camlp4 extension, does not refer
to the module Meths, but any module Meths that is
So then you need mutable option types or mutables that you initialize
with dummy values and then overwrite with the real thing once all
members of a cycle are created. Or some other trickery to make it
work. Overall cycles are generally not good.
I believe the trick you need (either passing a
In the process of discussing bug #5312, the caml team would like to
know if people still have use of the @responsefile feature under
windows. If not, it could be removed from the runtime -- that is from
all OCaml programs.
http://caml.inria.fr/mantis/view.php?id=5312
@responsefile is a
interface.
On Mon, Mar 5, 2012 at 2:46 PM, Jeff Schultz j...@csse.unimelb.edu.au wrote:
On Mon, Mar 05, 2012 at 11:46:08AM +0100, Gabriel Scherer wrote:
According to our Windows spies, the command-line restrictions are
nowadays very reasonable: 8K for cmd.com, and 32K internally. Maybe
to contact the
authors, or ask the caml-list.
http://protz.github.com/ocaml-installer/
http://caml.inria.fr/mantis/my_view_page.php
On Mon, Mar 5, 2012 at 4:10 PM, Jeff Schultz j...@csse.unimelb.edu.au wrote:
On Mon, Mar 05, 2012 at 03:31:55PM +0100, Gabriel Scherer wrote:
It looks to me like you
Note that Bar is actually unnecessary. The following code exhibit the
exact same behavior:
module Foo = struct
module St = struct type t = string let compare = compare end
module Map (* : Map.S with type key = St.t *)
= Map.Make(St)
(* module Map = Map.Make(struct type t =
On Thu, Feb 23, 2012 at 12:17 AM, Jacques Garrigue
garri...@math.nagoya-u.ac.jp wrote:
On 2012/02/23, at 3:49, Andreas Rossberg wrote:
On Feb 22, 2012, at 18.24 h, Gabriel Scherer wrote:
[A(B)] and [A.B] are syntacticly valid module_expr's but
[A(B).C] isn't. Is this because of an inherent
You could use the following work-around, which introduces an
additional layer to have some space to name the functor application:
module Map = struct
module Make (Ord : BatInterfaces.OrderedType) = struct
module M = BatMap.Make(Ord)
module Result : module type of M.Labels =
I had trouble being sure what meta filter you were talking about.
Here's what I found out, in case other people on the list wondered the
same: the meta part of Camlp4 is about turning a value into a piece
of OCaml AST representing the syntax of this value. The meta filter
is a kind of type-conv
My mistake, I wasn't aware or had forgotten this -- very useful indeed
-- feature.
Thanks, Vincent and Maxence, for the correction.
(Gabriel; sometimes bluestorm, for historical reasons, and often gasche.)
On Wed, Feb 15, 2012 at 9:44 AM, Maxence Guesdon
maxence.gues...@inria.fr wrote:
Hello,
.v with A - () | B - ()
(* works *)
In your case, you should write (module Make(O : Ops) : S with type foo
= ... and bar = ...).
On Tue, Feb 14, 2012 at 11:24 AM, Andre Nathan an...@digirati.com.br wrote:
On Tue, 2012-02-14 at 11:09 +0100, Gabriel Scherer wrote:
Here is an attempt at a functor
-u.ac.jp wrote:
On 2012/02/10, at 19:11, Gabriel Scherer wrote:
I've been playing with GADTs and noticed that the condition on
parameter variance is very restrictive.
The two following examples fail:
type +_ const =
| Const : int - int expr
type +_ expr =
| Const : 'a - 'a expr
There is no purpose, it's just an edge case of the simple lexical
specification you can find at:
http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#float-literal
Everywhere digits are allowed, you can insert extraneous underscores. There
is no restriction that there must be at least one digit
People. Please. Tell me you are *not* arguing over underscores in numeric
literals !
But it hides bugs, because if you see 10_000_ you are
much more likely to think it is 10^7 than you are with 1,
where you are likely to be careful and take your time.
So your point is : it is
I did not understand the whole picture of your question, but I think
I get the idea. You are looking for a way to manipulate an
heterogeneous set of values that have a common interface (possibly
a common subset of their interface), but may have different internal
representations. Your current
...@gmail.com wrote:
On 01/31/2012 10:58 PM, Gabriel Scherer wrote:
Sig.Ast is the most general structure available, that you use if you
want to manipulate any kind of grammar for Camlp4. If you know the AST
you're manipulating corresponds to an OCaml program, you should use
the more specific
You don't seem to like SQL much, which is surprising as it is kind of
isomorphic to comprehension of sets (of tuples). That's why F# added
first class SQL support with comprehension-like syntax
http://msdn.microsoft.com/en-us/library/hh225374(v=vs.110).aspx
This may be a little off-topic
I believe your best bet is the 'if .. then .. else' chain. You may
also use 'when' clauses in pattern matching, but those don't scale too
well and are best avoided if their are the only content of your
content: pattern matching are good for structural deconstruction and
environment binding, but
This means that biocaml and batteries interface with different
compiled versions of BatLogger. The solution is most likely to
recompile on biocaml's side, so that it gets uptodate with
batteries-side change. Assuming, of course, that you use Batteries's
BatLogger directly instead of duplicating
we miss a reStructuredText equivalent in OCaml, amazing how you can push
something online on the web in 5 minutes.
I'm not exactly sure what you mean by that. As markup formatters are
relatively self-contained programs, it's easy to use tools written in
basically any language (you don't even
For a description of how the value restriction is relaxed in the OCaml
type system, see the article
Relaxing the value restriction, by Jacques Garrigue, 2004
http://caml.inria.fr/about/papers.en.html
On Tue, Jan 10, 2012 at 6:20 PM, David Allsopp dra-n...@metastack.com wrote:
Dario Teixeira
What I am wondering is why type definitions are recursive by default. It
is mostly troubling for beginners.
Indeed, it is a defect of the language not to have non-recursive type
definitions. My usual reference on this topic is Yaron's complaint:
https://ocaml.janestreet.com/?q=node/25
The
I was also under the impression that ocamlbuild Ocamlfind integration was
unable to use archive(syntax) or archive(preprocessor) dependencies for
ocamlfind packages providing syntax extensions. This is a serious
limitation as it makes some ocamlfind packages unusable. If you're
considering
(1) Is any other syntax available for quotations apart from
:foo ... and the default quotation expander ... ?
No. That said, you could implement your own quotations mechanism as a
Camlp4 extension (changing the grammar of the language). The benefit
of the official quotations is that you don't
As for the build systems, I'd advise everyone to use OASIS instead of
custom
systems: it's not perfect on windows but for cairo2 and archimedes, I think
I only had to change paths from backward-slashes to forward-slashes in
setup.data (or the other way round) (took 15 seconds).
A
wrote:
Le 11/12/2011 00:34, Gabriel Scherer a écrit :
The original Camlp4 tool was mostly developped by Daniel de
Rauglaudre.
[...]
(I'm thinking of
eg. Martin Jambon, which had extensive Camlp4 extensions, and the Coq
team which has user-defined notations using Camlp4 and, huh, I really
don't
.
Evidently other people have a different opinion, and that's fine.
On Sun, Dec 11, 2011 at 1:47 AM, Wojciech Meyer
wojciech.me...@googlemail.com wrote:
Gabriel Scherer gabriel.sche...@gmail.com writes:
A summary to this lengthy mail:
(1) Why type-enriched Camlp4 is an unreasonable idea
(2) We
, and it would be clear that it is
a bit behind with the newest syntactical features. Also, it could be
developed outside the core team.
Gerd
Am Sonntag, den 11.12.2011, 11:29 +0100 schrieb Gabriel Scherer:
And Xavier's mail suggests that camlp4 is a maintenance burden for the
OCaml team.
Why
There already exist such a common denominator language. For
performance reasons, it is architecture-dependent (I mean there are
several dialects to better use hardware peculiarities; the virtual
machine it runs on is not exactly virtual). Unfortunately, most
languages have concentrated on
Edgar, It's excellent to know that you have some knowledge of Oasis-DB.
I share the common assumption that this is one of the missing bricks
of the OCaml ecosystem, and I hope the community at large can help
with it. I asked Sylvain about it a few months ago, but he wasn't sure
at that time what
A summary to this lengthy mail:
(1) Why type-enriched Camlp4 is an unreasonable idea
(2) We should extract the typedtree; why it's hard
(3) A fictional narrative of the camlp4/camlp5 history
(4) Why you don't want to become Camlp4 maintainer
(5) How we could try not to use Camlp4 in the future
(6)
I find the idea of making ocamlopt a GCC (or
LLVM) frontend the most sensible and constructive one I've seen in these
discussions.
Note that, besides Oleg excellent description of some issues, the idea
has already been discussed a few times before, here and on llvm-dev:
-
-Clang-centric project. I think your patches could bring value to
LLVM, independently of the success of the ambitious ocaml backend
attempt.
On Fri, Dec 9, 2011 at 1:08 PM, Benedikt Meurer
benedikt.meu...@googlemail.com wrote:
On Dec 9, 2011, at 10:58 , Gabriel Scherer wrote:
I find the idea
Martin, in the meantime, you can use Extlib's (Std.dump : 'a -
string) function, which is also integrated into Batteries. `dump` does
not require any modification to the compiler or toolchain.
For those that are not familiar with it, 'dump' uses the low-level
representation of OCaml values to
The French book Le langage Caml is very great, althought it is quite old,
and althought examples used in the book (write a pascal compiler, a grep
tool and so on) is maybe too theoristic for engineer target.
Maybe a translation would be sufficient ?
( For those interested, the book is
I would like to comment on a tangential aspect of the rationale you gave:
Given that OCaml is such a nice language with a lot of useful frameworks
available,
it is too sad to see it loosing ground just because of it's closed
development process
and lack of time of the official team.
I
There is a slighlt misinterpretation in your analysis of the issue:
the problem comes from the fact that OCaml 3.13 standard library has
added a ?seed optional parameter to the Hashtbl.create
method. Extlib's interface still assumes =3.12 interface with no
parameter (and in particular didn't
Here is how I understand the situation:
module type XARRAY =
sig
type 'a xarray
type 'a t = 'a xarray
end
(XArray : XARRAY with type 'a t := 'a XArray.xarray )
Type declarations do not match:
type 'a t = 'a XArray.xarray
is not included in
type 'a t = 'a
But having been recently forced out of emacs into a proprietary IDE to
be *able* to work on a project written in a
programmingLanguageWithAbsurdlyLongNamingConventions, one thing I
actually became very fond of is type aware autocompletion and the
ability to browse from a symbol in my code
Even staying at the interpreter stage, you can probably improve your
performance seriously by being careful about your implementation : use
efficient data structure (what is your implementation of variable
lookup?), avoid unnecessary allocation, use tail-recursive functions
where possible, etc.
What about hash tables ?
| Val_table of (value, value) Hashtbl.t
If you have caml closures in your values (not in Val_closure but in
Val_primitive), it is maybe not appropriate to use the default hash function
that would choke on them. You should rather define your own hashing function
--but
If record were structurally typed, there would be an ambiguity as to,
for example, what this function mean:
let access_foo t = t.foo
What would the type of `access_foo` be ? { foo : 'a } - 'a ? { foo :
'a; bar : 'b } - 'a ?
Should `access_foo { foo = 1 }` be typable? And `access_foo { foo = 1;
The with type foo = ... construct is meant to be used on signatures
(module interfaces), not on structures (module implementations).
First, a remark: if you want to share code, it's not terribly
comfortable if it's split into three different files of five lines
each. You could put your three
In my experience, the OCaml code doing recursive call and pattern
matching is a relatively bad way to reason about such rewrite systems.
Your questions are extremely pertinent, and relatively difficult to
answer in general.
For a start, I think your code indeed repeats useless traversals. This
(Constant 6., Variable X))
On Sun, Oct 2, 2011 at 6:48 PM, Gabriel Scherer
gabriel.sche...@gmail.com wrote:
On Sun, Oct 2, 2011 at 6:32 PM, Xavier Leroy xavier.le...@inria.fr wrote:
NBE is neat, but I'm skeptical that it will work out of the box here:
if you apply NBE to a standard
On Wed, Sep 28, 2011 at 1:53 PM, Thomas Fischbacher
t.fischbac...@soton.ac.uk wrote:
How come (Ftag funny) is regarded as constant while
(Rtag (ref funny)) is not? After all, strings are mutable in OCaml,
so there really is not that much of a conceptual difference between a
string and a string
Phantom types could be a solution but we must declare a new type for
each possible size, which is cumbersome / annoying.
If you define the type system yourself, you can easily add a family of
type constants `sizen` (with `n` an integer literal) to the default
environment of the type checker.
On Sat, Sep 17, 2011 at 2:08 PM, Goswin von Brederlow goswin-...@web.de wrote:
I think you are missing the point.
I totaly get why it must be '_a instead if 'a. My question is why it
doesn't infer the full type from the call to the print function.
You're correct, I was missing your point. You
On Thu, Aug 18, 2011 at 10:02 AM, ri...@happyleptic.org wrote:
Is there anything special in 3.12.1 to help library authors define
specialized comparison operators ?
Yes, from the 3.12.1 changelog:
- Added new operation 'compare_ext' to custom blocks, called when
comparing a custom block
You have hit the value restriction:
http://caml.inria.fr/resources/doc/faq/core.en.html#eta-expansion
# let g = (fun x - x) (fun x - x);;
val g : '_a - '_a = fun
# let g x = (fun x - x) (fun x - x) x;;
val g : 'a - 'a = fun
Polymorphism annotation ( : 'a . 'a - 'a ) have no use here, as you
, but I would like to avoid cluttering the code with __LOCATION__
everywhere.
Regards
Anders Fugmann
On 08/02/2011 11:21 PM, Martin Jambon wrote:
On 08/02/11 05:45, Gabriel Scherer wrote:
Finally, Martin Jambon also has its own cppo tools mimicking cpp,
which I suppose doesn't rely
I called ocamldoc by hand, the signatures I was interested in are
actually all contained in camlp4/Camlp4/Sig.ml so there is not much to
do.
On Wed, Aug 3, 2011 at 9:57 PM, Till Varoquaux t...@pps.jussieu.fr wrote:
On Tue, Aug 2, 2011 at 8:45 AM, Gabriel Scherer
gabriel.sche...@gmail.com wrote
This work is meant to make a compromise between generated code quality
and compilation speed to have good performances in rapid
prototyping/development scenario.
Do you have more precise measurements on
- the relative costs of the successive transformations during native
compilation (including
79 matches
Mail list logo