<aheller>
I'm sort of stumped. What does this mean:
<aheller>
Type Type.var = [ `Var ] is not compatible with type Type.any = [> ]
<aheller>
The second variant type does not allow tag(s) `Var
<Smerdyakov>
I guess the second type is occurring in a "rigid" context, where it can't be instantiated to a particular set of variant cases.
<aheller>
What makes a context rigid?
<Smerdyakov>
It's not a technical term. Maybe it would help for you to give your example program.
<aheller>
sure thing;
<aheller>
I have I Type.mli containing:
<aheller>
type +'a ty
<aheller>
type var = private [< `Var ]
<aheller>
type tuple = private [< `Tuple ]
<aheller>
type any = private [> `Any ]
<aheller>
val tvar : string -> var ty
<aheller>
val fn : any ty * any ty -> any ty
<aheller>
(relevantly)
<aheller>
(type tuple shouldn't be important there, actually)
<Smerdyakov>
OK..
<aheller>
and type.ml containing
<aheller>
module I = Ident
<aheller>
type var = private [< `Var ]
<aheller>
type tuple = private [< `Tuple ]
<aheller>
type any = private [> `Any ]
<aheller>
type +'a ty = | TyVar of string | TyRow of (I.label * any ty) list | TyCon of any ty list * I.longtycon | TyTup of any ty list | TyFun of any ty * any ty
<aheller>
And then definitions of tvar and fn that just call the constructors (tvar checks to make sure its argument starts with ')
<aheller>
The goal is to make sure I don't screw up and put a type which isn't a type variable in a place where my AST demands that it be.
<Smerdyakov>
I'm waiting to hear which piece of code elicits the error message....
<aheller>
Oops, sorry: let foo = Type.tvar "'foo" in fn (foo,foo);;
<aheller>
that gives:
<aheller>
Type Ml.var = [< `Var ] is not compatible with type Ml.any = [> `Any ]
<aheller>
The second variant type does not allow tag(s) `Var
<Smerdyakov>
It's pretty obvious that a [Type.var Type.var] can never be used as a [Type.any Type.var].
<Smerdyakov>
I think your use of private row types is not helping at all.
<aheller>
I'm pretty slow, I guess. Why's that?
<aheller>
That was cargo-cult programming.
<Smerdyakov>
[var] must be [ [ `Var ] ], since you can't have empty polymorphic variant types.
<aheller>
I've gone through a bunch of iterations of this trying to get things working, that's what the code looked like when I copied it.
<Smerdyakov>
Clearly that type doesn't contain [`Any], which would be required to unify with [any].
<aheller>
My impression was that [any] had a hidden type variable inside it.
<Smerdyakov>
Yup, and you get the constructors of [any] by adding [`Any] to the fields of that hidden variable.
<Smerdyakov>
So [`Any] is always included.
<Smerdyakov>
Do you understand what the tokens beginning with backticks are?
<aheller>
I presumed they were global, unary value constructors.
<aheller>
err, nullary.
<Smerdyakov>
Then you understood that [any] must take the form [ [ `Any | other stuff here ] ]?
<aheller>
Are you saying I have things upside down?
<Smerdyakov>
I don't know. I'm just saying that it's obvious why your code doesn't type-check, and I'm asking you a question that you haven't answered yet. :P
<aheller>
I won't say I understood, then, but that's what I thought was going on.
<Smerdyakov>
This is just getting confusing for me. I'm going to leave soon, but I suggest coming up with an explanation of why you think your code should work.
<aheller>
Fair enough.
<aheller>
Thanks for the help.
redocdam has quit [Remote closed the connection]
Morphous has joined #ocaml
Jessehk has quit ["Leaving"]
Morphous_ has quit [Connection timed out]
Kopophex has joined #ocaml
sponge45 has left #ocaml []
Axioplase has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
Associat0r has joined #ocaml
Kopophex has quit [Read error: 110 (Connection timed out)]
Kopophex_ has joined #ocaml
Kopophex_ is now known as Kopophex
seafood has joined #ocaml
bluestorm has joined #ocaml
ygrek has joined #ocaml
RobertFischer has quit []
Kopophex has quit [Read error: 110 (Connection timed out)]
Proteus_ has quit [Read error: 110 (Connection timed out)]
Proteus_ has joined #ocaml
seafood has quit []
bluestorm has quit [Remote closed the connection]
seafood has joined #ocaml
Axioplase has quit ["leaving"]
hkBst has joined #ocaml
Linktim has joined #ocaml
ulfdoz has quit [clarke.freenode.net irc.freenode.net]
ecc has quit [clarke.freenode.net irc.freenode.net]
mbishop has quit [clarke.freenode.net irc.freenode.net]
Ugarte has quit [clarke.freenode.net irc.freenode.net]
dellsuck1 has quit [clarke.freenode.net irc.freenode.net]
dellsuck1 has joined #ocaml
ecc has joined #ocaml
ulfdoz has joined #ocaml
mbishop has joined #ocaml
Ugarte has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
hkBst has quit ["Konversation terminated!"]
tomh has joined #ocaml
ygrek has quit [Remote closed the connection]
rwmjones has joined #ocaml
ygrek has joined #ocaml
asmanur has joined #ocaml
Proteus_ has quit [Read error: 113 (No route to host)]
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
ofaurax has joined #ocaml
jlouis has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
munga_ has quit ["Ex-Chat"]
Yoric[DT] has joined #ocaml
pattern has quit [Read error: 110 (Connection timed out)]
seafood_ has quit []
Proteus has joined #ocaml
asmanur has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
strangy has joined #ocaml
jlouis has quit ["Leaving"]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
sporkmonger has joined #ocaml
jjido has joined #ocaml
<jjido>
Hello. Anyone familiar with the Aurochs parser?
<jjido>
Uh, I'd like to use a source-to-XML parser like the one on the Aurochs web site. I found an example of it in the Aurochs java folder, but it does not compile. I wonder if there is an O'caml version?
<tsuyoshi>
what is aurochs? never heard oif it before
vixey has quit ["* I'm too lame to read BitchX.doc *"]
mishok13 has joined #ocaml
strangy has quit ["Leaving"]
marmotine has quit [Read error: 60 (Operation timed out)]
Yoric[DT] has quit ["Ex-Chat"]
vixey has joined #ocaml
sporkmonger has quit []
marmotine has joined #ocaml
Linktim has quit ["Quitte"]
<fremo>
'lo, is it a problem to read a fd using a channel and writing on it with Unix.write ?
<fremo>
I have a bug around "Buffer.add_channel buffer channel len"
<fremo>
When I strace my program, the bug doesn't appear...
<fremo>
If I replace this by "for i = 0 to len-1 do Buffer.add_channel buffer channel 1", it doesn't appear
<fremo>
I have no clue on how to investigate more :/
<Smerdyakov>
Why are you using a loop?
<fremo>
just to try,
<fremo>
the fact is that it workaround the problem
<fremo>
...It's a network socket...
<Smerdyakov>
I can't help you with your question. Sorry. I just like to complain when people use loops. ;)
<fremo>
:)
<fremo>
I used the loop to see if there is enought data to read
<fremo>
Maybe there is a race thing, I have a select behind that and maybe all the data isn't available when it says they are (at least after several read notifications)
<mfp>
fremo: how do you know the appropriate len argument to add_channel?
<mfp>
the docs say it'll try to read exactly len bytes, not at most len bytes
<fremo>
it is the len I need, it's on a nonblock fd so I got Sys_blocked_io if there is not enough data
<fremo>
then I try at the next select read notification
<fremo>
I know that the data are here thanks to tcpdump
<fremo>
I am not sure at 100% but a 99.9% that the data arrives
<mfp>
I see. Are you getting an End_of_file exception or is it a different error?
<fremo>
not in this precise case
<fremo>
but the documentation is only mentionning End_of_file
<mfp>
and you're getting something else?
<fremo>
that's something to investigate
<fremo>
other exceptions ?
<mfp>
yes, what are you observing?
<fremo>
I got something like Sys_error("connection closed") when the other side close the socket
<fremo>
but I dont know how to observes more
<fremo>
when I use strace or tcpdump, things go all right
<mfp>
ouch
Associat0r has quit []
<mfp>
My best guess was that the system might not be delivering the received data at once (maybe because it came in different packets?), but this doesn't explain the Sys_error.
thermoplyae has left #ocaml []
<fremo>
the Sys_error is ok, it is to significate that the other side close the socket and that is expected,
<mfp>
but is it when there's still buffered data?
<fremo>
I am reading buffer.ml and pervasives.ml, add_channel call really_input...
<mfp>
if it really signals EOF, it's OK, of course
<fremo>
it is when I close it by myself on the other side
<vixey>
Why aren't there linear types in ml?
<vixey>
is it because type inference cannot be done or they are not useful or another reason?
<mfp>
vixey: maybe because aliases are deemed useful?