Hi,
And once more, thanks for your very informative reply. I spent the last
few days exploring these issues (there's quite some info on the Haskell
wiki) and weighting in the pros/cons of each solution.
I've decided for an approach similar to that taken by the Ocsigen guys.
That is, acknowledge
Hi Jacques,
From: Jacques Carette care...@mcmaster.ca
Hmmm, a variant of your code may be exhibiting a bug in ocaml 3.11.0.
In your signature, change the +'a t signature to
type +'a t = private [ elem_t ]
and remove all annotations from the definition of sprint2. Then, as
defined,
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:
From: Dario Teixeira darioteixe...@yahoo.com
So my question is how can I make the Foobar code behave as if it were
defined inside Node. Based on a previous thread [1], I'm guessing there
is a solution, but I've been unable to hit on its exact formulation.
There have been no replies yet
Hi,
Thank you very much for your help, Jacques! It's always enlightening to
see an Ocaml ninja in action, though I'm still digesting the finer points
of your message. Anyway, I have implemented all three solutions you suggested:
a) Using a private row and PV
b) Using a private abbreviation and
Hi,
On Wed, Jan 21, 2009 at 11:11:14AM -0800, Dario Teixeira wrote:
So my question is whether it
is at all possible to emulate GADTs using only PV + phantom types, or if on
the
contrary one needs to use the object system in these cases, as exemplified by
solution c). In other words, is
From: Dario Teixeira darioteixe...@yahoo.com
Thank you very much for your help, Jacques! It's always enlightening to
see an Ocaml ninja in action, though I'm still digesting the finer points
of your message. Anyway, I have implemented all three solutions you
suggested:
a) Using a
Hi again,
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: while function 'sprint' works alright
Hi,
Hmmm, a variant of your code may be exhibiting a bug in ocaml 3.11.0.
Thanks for the reply. I'm kind of hoping it is indeed a bug, because
those are fixable and it would mean what I intend to do is feasible...
Best regards,
Dario Teixeira
Hi,
So my question is how can I make the Foobar code behave as if it were
defined inside Node. Based on a previous thread [1], I'm guessing there
is a solution, but I've been unable to hit on its exact formulation.
There have been no replies yet to my question, but I'm still stuck with
this
Hi,
(Note: this problem is similar to one I've posted before; there are however
differences. Also, my apologies for the problem requiring a long introduction
before actually being presented).
Consider a sequence of nodes such as those present in an inline context in
XHTML. Some of these nodes
David Allsopp wrote:
I agree that the error will still show up somewhere if there is an error -
but remember that a closed polymorphic variant type required an annotation
in the first place (in this case, the type [t] and the explicit type
annotation to use it)... so having made the explicit
Edgar Friendly wrote:
Jacques Garrigue wrote:
Your intuition is correct that it would theoretically be possible to
try subtyping in place of unification in some cases. The trouble is
that thoses cases are not easy to specify (so that it would be hard
for the programmer to known when he
Jacques Garrigue wrote:
If we limit ourselves to the case where both [x] and [y] contrain no
type variables, this si not particularly difficult. However whether
they will contain type variables or not depends heavily on how the
type inference algorithm proceeds.
If they contain type
Edgar Friendly wrote:
David Allsopp wrote:
Without the full coercion for x you'll get a type error because the type
checker infers that the type of the [if] expression is [t] from the
[then] branch and then fails to unify [ `B of int ] with [t] unless the
type of [x] is first coerced to
Hi,
Your intuition is correct that it would theoretically be possible to
try subtyping in place of unification in some cases. The trouble is
that thoses cases are not easy to specify (so that it would be hard
for the programmer to known when he can remove a coercion), and that
subtyping is
Jacques Garrigue wrote:
Your intuition is correct that it would theoretically be possible to
try subtyping in place of unification in some cases. The trouble is
that thoses cases are not easy to specify (so that it would be hard
for the programmer to known when he can remove a coercion),
Le 30 oct. 08 à 21:18, David Allsopp a écrit :
Shouldn't I now be able to say:
string_of_int x;;
I don't think so. According to the manual [1] the only thing you can
do on private types is pattern match or project their fields. I
doesn't mean your type can be substituted by int.
David Allsopp [EMAIL PROTECTED] writes:
I thought that the point of private types was that you could
deconstruct them... so values of type M.t are valid wherever an int
is used but not the converse.
It should probably be ok for immutable data but not for mutable
ones. One example is using
Daniel Bünzli wrote:
Le 30 oct. 08 à 21:18, David Allsopp a écrit :
Shouldn't I now be able to say:
string_of_int x;;
I don't think so. According to the manual [1] the only thing you can
do on private types is pattern match or project their fields. I
doesn't mean your type can be
From: David Allsopp [EMAIL PROTECTED]
Thanks for this - although it's a link to an OCaml 3.10 manual so not
applicable here it did point me to the correct chapter in the OCaml 3.11
manual (I'd been looking in Part I of the manual and given up). What I
should have written is
string_of_int
21 matches
Mail list logo