<Mongo>
And I'm trying to use all these with something like: "let d = NormalRegexParser (NormalGraph) (RecordEdge)", where NormalGraph and RecordEdge are implementations of their respective module types.
jao has quit [Read error: 113 (No route to host)]
Yurik has joined #ocaml
* gl
is away: mioum.
gl has quit [Remote closed the connection]
<smkl>
Mongo: you should use something like: module M = NormalRegexParser (NormalGraph) (RecordEdge)
gl has joined #ocaml
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger."]
gl has joined #ocaml
<Mongo>
"Signature mismatch: Modules do not match: sig .. end is not included in Graph.GRAPH"
<Mongo>
Looking at the the contents of the sig (module NormalGraph: functor (..) -> sig .. end), it's identical to GRAPH, except that in the sig, t is defined as "('a,'b) Normalgraph.NormalGraph(E).t", instead of as a generic t.
<smkl>
"type t" is different from "type ('a,'b) t". but if you don't have that error, i can't help without seeing the code
olczyk has quit [Read error: 113 (No route to host)]
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger."]
gl has joined #ocaml
<Mongo>
GRAPH defines it as 'type ('a,'b) t', whereas NormalGraph does 'type ('a,'b) t = { mutable nodes: 'a list; mutable edges: ('a,'b) E.t list }' (where E is a functor param)
<Mongo>
when I try and 'module M = NormalRegexParser (NormalGraph) (RecordEdge)', which creates the Graph, I get the error listed above. It's signature matches Graph with the exception of the ('a,'b)t.
<Mongo>
I can post full code somewhere, but I've been in situations where I'm the one helping people, and I never liked people who posted code and said 'fix this for me'. :P
<smkl>
wait, sig .. end cannot match GRAPH because graph is a type of functor, not structure .. what is NormalGraph?
<smkl>
ok you should have NormalGraph instead of Normalgraph in the instantation
<Mongo>
Is it just that I'm new to the language, or could the error messages really be improved? :)
<Mongo>
From I can see, test.ml *is* using Normalgraph in the instantiation.
<Mongo>
The error is the only thing that's displaying NormalGraph (along with normalgraph.ml, that is)
<smkl>
what you need is Normalgraph.NormalGraph. because you have opened Normalgraph you can use just NormalGraph
<Mongo>
Er. Doh. I mixed up the names in your last bit of advice. Makes more sense now. :)
<smkl>
i'm sure most error messages from ocaml could be better
<Mongo>
I keep playing around with the case I'm using, since it wants one kind in some places, and others elsewhere...
<Mongo>
Filenames are Upper-initial, lower-rest. And modules are case-exact?
<Mongo>
Of course, now that I do that, I get "Reference to undefined global `Recordedge'" when trying "module MyParser = NormalRegexParser (NormalGraph) (RecordEdge);;" And yes, I've already done "open Recordedge"
<smkl>
at least on unix, filenames can have upper letters later
<smkl>
you are probably not linking recordededge.cmo
<Mongo>
Hrm? recordedge.cmo exists, and I just recompiled it to ensure it was up to date. Do I have to manually link the file somehow?
<smkl>
perhaps you can use the compiler like: ocamlc -c recordedEdge.cmo to have different case
<smkl>
the files are linked into executable with: ocamlc -o exec a.cmo b.cmo etc.
<Mongo>
Well, I was trying to compile test.ml, but it is giving me an error at the end of the file. "File "test.ml", line 16, characters 0-0: syntax error". So instead, I put my current directory into the commandline via -I and started OCamlWin.exe, and attempted to put in test.ml a piece at a time at the prompt.
<Mongo>
Yeah, I know about that (the -o). But I'm trying to compile the program before I try and link it. :)
<Mongo>
and yes, specifying a different case to -c does seem to help the case-ish-ness of the filenames.
<smkl>
try #load "foo.cmo" with the toplevel
<smkl>
the ocaml toplevel syntax might be a bit confusing. there are two alternatives, using "... ;;" like at the toplevel or "let .. = ... let .. = ..."
<Mongo>
I usually use a;\nb;\nc;\nd for files. And "a;;\n" etc in the interpreter
<smkl>
"let a = 1; let b = 2" is not valid
<Mongo>
I usually get syntax errors with it, and then switch to 'let ..=.. in let ..=.. in begin a..;b.. end'
<Mongo>
reloading everything into a fresh ocaml interpreter and trying 'module MyParser = NormalRegexParser (NormalGraph) (RecordEdge);;' again, it gives an entirely different error.
<Mongo>
This module is not a functor; it has type sig module NormalRegexParser : functor (G : Graph.GRAPH ) -> (E: Edge.EDGE) -> sig ... end end
<smkl>
now you didn't open NormalRegexParser
<smkl>
usually the functor has a name like Make in ocaml
<smkl>
so you'd have NormalRegexParser.Make ...
<Mongo>
Ah. Good point (didnt open). I suppose I just need to use ocaml more, to get a feel for how to interpret what errors really mean. :|
<Mongo>
Ah, and that would allow me to avoid opening files, wouldn't it...
<smkl>
yes. you could also use NormalRegexParser.NormalRegexParser but ...
<Mongo>
Yeah. I wanted to avoid that. :) I liked how putting the code raw in X.ml made a module X which was auto-loaded, but couldn't figure out how to combine that with functors.
<Mongo>
Anyways, after refactoring it all to use the .Make syntax (no more opens!), I still get the "Reference to undefined global `RecordEdge'" error... :|
<smkl>
did you do: #load "recordEdge.cmo"
<Mongo>
Erg. keep getting distracted. I do very much appreciate your help. Anyways, loading that helps. Then loading NormalGraph helps. But then I'm unable to load NormalRegexParser because of undefined global Str.
<smkl>
try #load "str.cma". if that doesn't work, see the manual page for Str library
<Mongo>
Yay. Finally compiles/parses/runs that line of code. Can you explain why I needed to manually #load the .cmo files, if it can automatically figure out which .ml and .mli files to load?
<smkl>
the .cmo files might have initialization code, order of that code matters, perhaps that is one reason. usually it is easiest to use a makefile that builds the program or toplevel with all the modules linked in
<smkl>
btw, if you only have an interface, it's best to use an .ml file instead of .mli
<Mongo>
.mli is intended to correspond to a .ml ?
<smkl>
yes
<smkl>
(then you need to link in more files, though)
tav` has joined #ocaml
tav has quit [Read error: 104 (Connection reset by peer)]
<Mongo>
Any idea why I'd get "Cannot find file std_exit.cmo" when trying to link together my application?
<Mongo>
scratch that.
<Mongo>
I get a syntax error at the end of my test.ml script, which I'm trying to compile into an exe. Line 13, characters 0-0 Syntax error. Can't figure out what's needed to fix it. Suffixing the last line with nothing or a semicolon, I get the same error.
<Mongo>
Same with converting it over to the ;; style, per one of the examples in the ora book
jao has joined #ocaml
<smkl>
try making a function let main () = ... and then let _ = main ()
<Mongo>
Tring to use a begin .. end to capture my code. But reducing it to "let main () = begin let a = 0 end" still gives me problems. Replacting the inner code with a print_string works fine, however.
<Mongo>
And of course, it's a "Syntax Error". Specifically, on the end.
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger."]
gl has joined #ocaml
<Mongo>
Is there something wrong with my understanding of the begin .. end syntax?
ott has joined #ocaml
<ott>
hello all
<smkl>
Mongo: begin ... end is other way of saying ( ... )
<Mongo>
Ack! I just reverted to the code I had uploaded, and that seems to work fine. I apologize for that.
<Mongo>
I get a "Fatal error: cannot load shared library dllstr\nReason: The specified module could not be found." when attempting to run my compiled executable. Not sure if you can help with that, since you're not using OCamlWin, iirc.
<smkl>
did you link it with str.cma?
<Mongo>
yeah, it said it needed it.
<Mongo>
Do I need to run it from the ocaml/bin directory?
<Mongo>
that didn't seem to help.
<smkl>
no idea
<smkl>
anyways, i think you need to know how dynamic linking is handled by your linker, VC or cygwin
<Mongo>
I have both VC and cygwin/GCC installed. I downloaded the binary version of ocamlwin, however.
<Mongo>
I suppose I can just test it on my linux box, once I get it all compiling. I'm assuming support is better there than on windows.
<smkl>
yes, ocaml is clearly an unix program
tav` has quit [Read error: 104 (Connection reset by peer)]
tarball_ has joined #ocaml
<tarball_>
hello
<smkl>
hi
<ott>
tarball_: hello
<tarball_>
never heard of Ocaml before...
ott has quit [Read error: 104 (Connection reset by peer)]