vpalle has quit [Read error: 110 (Connection timed out)]
<flux>
yoric[dt], btw, how does/does it handle higher order functions neatly? so what would be the signature for List.filter, where the function can throw an exception?
<flux>
I suppose one option is to explicitly encode the exceptions the function can throw, like val filter : ('a -> (bool, 'b) result)) -> 'a list -> ('a list, [`FuncFailed of 'b]) result ?
<Yoric[DT]>
Something along the lines of ('a -> (bool, 'b) result) -> 'a list -> ('a list, 'b) result .
<Yoric[DT]>
Ah, well :)
<Yoric[DT]>
I don't think `FuncFailed would be necessary for filter.
<flux>
not for filter, but some other function that itself can fail
<bluestorm>
looks like a filterM
<Yoric[DT]>
flux: in that case, yes
<Yoric[DT]>
bluestorm: yes, something like this.
<Yoric[DT]>
It's definitely lifting things more-or-less manually.
seafood has joined #ocaml
<flux>
iirc reddit or LtU or both had a paper (..which I didn't read..) that stated that unchecked exceptions are more powerful than call/cc, the reasoning being that they can make a non-TC machine TC, while call/cc cannot
<flux>
I suppose in that case these polymorphic variants plug that "tc-hole" also
<Yoric[DT]>
I vaguely saw that on LtU.
<Yoric[DT]>
The summary seemed to hint that the proof was given by using Turing Machines, which in turn hinted that I would not be overly interested in reading it.
<flux>
:)
<Yoric[DT]>
mmmhhhh....
<Yoric[DT]>
Looking at the source code of ocamlc, I have the nasty feeling that there's no easy way to replace Pervasives.
<Yoric[DT]>
Of course, a little bit of camlp4 might do the trick by adding "open Bla" at the beginning of each file.
Myoma has joined #ocaml
rwmjones has joined #ocaml
<Camarade_Tux>
maybe we can ask upstream to simplify that, they seem to be willing to help for that (just an idea I had in the metro ;) )
<gildor>
Camarade_Tux: I think that upstream will change things only if you provide patches
<Camarade_Tux>
I thought a few small changes would suffice but well, I don't know, and now I have to pack, I'm leaving in one hour
<Yoric[DT]>
gildor: I think a patch has been lying on the tracker for about 3 years now...
marmotine has joined #ocaml
<Yoric[DT]>
bluestorm: nice.
<Yoric[DT]>
How did you generate it?
kig has joined #ocaml
Asmadeus has joined #ocaml
<flux>
guessing: ocamldoc+graphviz?
<bluestorm>
yes, ocamldoc + dot
<Yoric[DT]>
Well, obviously not just that, since the names printed are not always the module names.
<bluestorm>
hm
<Yoric[DT]>
So I guess ocamdoc + dot + grep?
<bluestorm>
sed :]
<Yoric[DT]>
Nearly :)
<Yoric[DT]>
bluestorm: you may wish to take a look at the first part of odoc_generator_batlib.ml .
<Yoric[DT]>
It's the part where everything gets rewritten to reveal the directory structure.
<bluestorm>
ok
<Yoric[DT]>
It's incomplete for the moment -- some stuff only takes place at rendering time.
<Yoric[DT]>
At some point, I'll try and complete this into a full rewriting (with resolution of references) and simple rendering.
rby has joined #ocaml
Proteus has joined #ocaml
marmotine has quit ["mv marmotine Laurie"]
rwmjones_ has joined #ocaml
Proteus has quit [Read error: 113 (No route to host)]
Proteus has joined #ocaml
Asmadeus has quit ["cya !"]
Associat0r has joined #ocaml
Proteus_ has joined #ocaml
Proteus has quit [No route to host]
filp has joined #ocaml
munga has joined #ocaml
Proteus_ has quit [No route to host]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Success]
seafood has joined #ocaml
<flux>
funny how ocamlspotter (http://www.furuse.info/jun/hacks/ocamlspotter/) requires ocaml compiler (sources) to do its magic. but I suppose that information is only available from that level :/.
sporkmonger_ has quit []
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
OChameau has joined #ocaml
ygrek has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
struktured has quit [Read error: 110 (Connection timed out)]
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
sporkmonger has joined #ocaml
sporkmonger_ has joined #ocaml
sporkmonger has quit [Read error: 110 (Connection timed out)]
thelema has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
ygrek has joined #ocaml
Proteus has joined #ocaml
Proteus_ has joined #ocaml
^authentic has joined #ocaml
Proteus has quit [Connection reset by peer]
gk has quit [Read error: 113 (No route to host)]
Proteus__ has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
Proteus has joined #ocaml
Proteus__ has quit [Connection reset by peer]
jynxzero has quit [Read error: 110 (Connection timed out)]
Proteus_ has quit [Read error: 113 (No route to host)]
Proteus_ has joined #ocaml
threeve has joined #ocaml
threeve_ has joined #ocaml
Proteus__ has joined #ocaml
threeve__ has joined #ocaml
threeve___ has joined #ocaml
jynxzero has joined #ocaml
threeve____ has joined #ocaml
threeve_____ has joined #ocaml
seafood has quit []
Proteus_ has quit [No route to host]
threeve has quit [Read error: 110 (Connection timed out)]
Proteus has quit [No route to host]
threeve_ has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]>
I'm still looking for a good idea on how to automatically open a module, btw.
<Yoric[DT]>
If anyone has clues, I'm interested.
Proteus__ has quit [Read error: 113 (No route to host)]
threeve has joined #ocaml
threeve__ has quit [Read error: 110 (Connection timed out)]
threeve___ has quit [Read error: 110 (Connection timed out)]
threeve____ has quit [Read error: 110 (Connection timed out)]
threeve_____ has quit [Read error: 110 (Connection timed out)]
dominic- has quit [Read error: 104 (Connection reset by peer)]
sporkmonger has joined #ocaml
<Yoric[DT]>
Note: replacing Pervasives just won't do.
Proteus has joined #ocaml
filp has quit ["Bye"]
jlouis has joined #ocaml
sporkmonger_ has quit [Read error: 110 (Connection timed out)]
mishok13 has quit [Read error: 60 (Operation timed out)]
lecas has joined #ocaml
Proteus_ has joined #ocaml
Proteus has quit [Read error: 104 (Connection reset by peer)]
Snark has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
Proteus has joined #ocaml
mediogre has quit [Remote closed the connection]
Proteus_ has joined #ocaml
Proteus has quit [Read error: 104 (Connection reset by peer)]
<kig>
driver/compile.ml and optcompile.ml have something on Pervasives
<Yoric[DT]>
Yeah, I've read it,
<Yoric[DT]>
and I'm quite pessimistic.
<kig>
yeah
Proteus__ has joined #ocaml
Proteus__ has quit [Connection reset by peer]
Proteus__ has joined #ocaml
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
ertai: ping
jdev has joined #ocaml
<kig>
you could use -pp "cat prefix.ml -"
Proteus has joined #ocaml
<kig>
er, just "cat prefix.ml"
<kig>
where prefix.ml: "open MyPervasives"
<kig>
mypervasives compiled without -pp
Proteus_ has joined #ocaml
Proteus__ has quit [No route to host]
<kig>
oh hey, it works
<kig>
with both ocamlopt and ocamlc
Linktim has joined #ocaml
<Yoric[DT]>
kig: yes, but it's bound to cause a few problems with ocamldoc.
<flux>
hmm, why?
<Yoric[DT]>
Let me check.
<Yoric[DT]>
Hey, it works.
<Yoric[DT]>
So I don't need Camlp4 after all.
<Yoric[DT]>
I was afraid that putting an [open] before the first comments of a module would turn these comments into non-special comments rather than module information.
<Yoric[DT]>
But it seems to work.
<Yoric[DT]>
Now I just need to find out how to call that "cat prefix.ml" from ocamlfind...
Proteus has quit [Read error: 113 (No route to host)]
maattd has joined #ocaml
Palace_Chan has joined #ocaml
<Yoric[DT]>
mmmhhhh.....
<Yoric[DT]>
Interesting idea.
<Yoric[DT]>
I was attempting to toy with "-syntax".
<Yoric[DT]>
Now, if only I could find how to change "ocamlc" from within a META file.
<flux>
does open work with .mli-files also?
<Yoric[DT]>
yes
<Palace_Chan>
what does the >:: do ?
<flux>
palace_chan, context?
<flux>
>:: doesn't really ring a bell :)
<Palace_Chan>
"somestring" >::
<flux>
ah
<flux>
it's a custom operator
<flux>
so the meaning has been defined in the source somewhere
<Palace_Chan>
flux, ah ok, ill do a search for it
<flux>
either in the same file or in stuff you've open'ed/included
<bluestorm>
my bet on OUnit
Amorphous has quit [Read error: 104 (Connection reset by peer)]
<Palace_Chan>
i have g : 'a -> 'b and k of type 'a list and build of type 'b list......in a pattern match for k i wrote: h::rest -> (g h) :: build, but i get as an error: This expression is not a function, it cannot be applied
<Palace_Chan>
why would that be ?
<flux>
perhaps you could put the whole function causing the problem to a pastebin site
<Palace_Chan>
im trying to, in the case of k not empty list..to grab the head, apply g to it..and then cons that to the build list
<Palace_Chan>
flux, i could do that, do you know a pastebin with ocaml syntax highlighting ?
<flux>
that is the same as: (g h) :: build loop g rest build
<flux>
so build is used in function context there
OChameau has quit ["Leaving"]
<Palace_Chan>
so i would have to add a single ;
<Palace_Chan>
?
<flux>
what are you trying to do with the (g h) :: build?
<Palace_Chan>
i'm trying to apply g to the head of the list k, and then cons it to the build list
<flux>
well, it does construct a new list out of (g h) and build
<flux>
where does that constructed list go?
<Palace_Chan>
it is not accumulated over the recursive calls ?
<flux>
((g h) :: build) is an expression
<flux>
it doesn't modify anything
<Palace_Chan>
ah yes i see
<kig>
you probably want loop g rest ((g h) :: build)
<Palace_Chan>
let's see
<kig>
unless a value is a ref or a member of a mutable record, you can't change it: hence the recursion by passing new values
<kig>
you could also do let build = (g h) :: build in loop g rest build
<Palace_Chan>
kig, well that certainly compiled
Amorphous has joined #ocaml
ulfdoz has joined #ocaml
marmotine has joined #ocaml
Proteus__ has joined #ocaml
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
Yeah!
<Yoric[DT]>
Pervasives successfully masked.
<Yoric[DT]>
kig: thanks for the idea.
<Yoric[DT]>
I was looking for something much more complex (i.e. using Camlp4 to insert the command right after the first comment or something such).
<Yoric[DT]>
Gasp.
Proteus_ has joined #ocaml
<Yoric[DT]>
It works but it's not robust :/
Proteus__ has quit [Connection reset by peer]
<Yoric[DT]>
I'm therefore back to square 1 :/
Proteus has joined #ocaml
<flux>
how is it not robust?
<Yoric[DT]>
ocamlc -pp mypreprocessing -pp camlp4o => the first -pp is ignored
<Yoric[DT]>
So I guess I really should use camlp4o.
<Yoric[DT]>
If I understand how to get things done on a per-file basis.
<flux>
hmm.. I wonder why ocamlc couldn't support multiple preprocessors?
<Yoric[DT]>
Well, it's implemented as a [Arg.String].
Proteus__ has joined #ocaml
<Yoric[DT]>
And in turn, the function called sets a reference.
<Yoric[DT]>
No list there.
<Yoric[DT]>
:/
<flux>
setting up multiple preprocessors would also need some new code I take it
<Yoric[DT]>
Otoh, iirc, findlib already has what's necessary to chain multiple camlp4 preprocessors.
<Yoric[DT]>
(since camlp4 already has that capability)
<Yoric[DT]>
So if we can get a camlp4 preprocessor which just adds one expression at the beginning of the file, we're good.
<Palace_Chan>
if i take a list k as an argument, is there a quick way to grab the head of the list without using match k with h::tail ?
mbishop has joined #ocaml
<kig>
List.hd, but it raises an exception if you call it with an empty list
<Palace_Chan>
kig, so in any case i would probably want to use a match
<kig>
yes
Proteus_ has quit [Read error: 113 (No route to host)]
<kig>
match makes code safer and easier to understand, so the more match you use, the less bugs you have :)
Proteus_ has joined #ocaml
<Yoric[DT]>
bluestorm: ping
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
<bluestorm>
pong
Proteus_ has joined #ocaml
<Yoric[DT]>
bluestorm: do you have an idea?
<bluestorm>
hm
<bluestorm>
i must say i quite fail to get interested in that pervasives-replacement debate
<Yoric[DT]>
The objective being to add one [open] directive at the beginning of each file.
<Yoric[DT]>
Well, maybe camlp4 can get you interested :)
<bluestorm>
well, camlp4 could do that for sure
<Yoric[DT]>
How?
<bluestorm>
and you can combine preprocessors with the thing the ocaml+twt processor wrote
<bluestorm>
hm
Proteus has quit [Read error: 113 (No route to host)]
<bluestorm>
the easiest way is probably a syntax extension that add stuff before "implem"
<bluestorm>
(and signature also if needed)
<bluestorm>
a filter would work fine too
<Yoric[DT]>
But that will have a different effect.
<bluestorm>
hm
<bluestorm>
how that ?
<Yoric[DT]>
If you have a struct inside a .ml, it will call twice [open Bla].
<Yoric[DT]>
Won't it?
<bluestorm>
i don't think so
<Yoric[DT]>
If so, it may mask useful names.
<bluestorm>
"implem" is a file-wide construct iirc
<Yoric[DT]>
Doesn't "implem" serve also for "struct"?
<Yoric[DT]>
Ah, ok.
<flux>
it's slightly negative is using batteries requires camlp4, because camlp4's syntax errors differ from ocaml's
<Yoric[DT]>
My bad.
<bluestorm>
structs only use str_item
Proteus has joined #ocaml
<flux>
also it needs to work in the toplevel also in a natural way
<bluestorm>
yes
<flux>
"negative if", not "is"
<bluestorm>
would it not be possible to use modified ocaml/ocamlc/ocamlopt instead of changing each file ?
<bluestorm>
i'm thinking the ocamlmktop kind of things
<bluestorm>
hm
<flux>
well, it's a less-than-optimal situation if everyone needs to upgrade ocaml etc for batteries
<bluestorm>
it's actually probably harder than the camlp4 way
<bluestorm>
flux: i don't think "anyone" would be concerned
<Yoric[DT]>
Well, if you find a ocamlmktop kind of stuff, good.
<Yoric[DT]>
But the source code of ocamlc seems to disagree with that option.
<bluestorm>
i'm perfectly happy with the included batlib using ocamlfind manually
<bluestorm>
and i suppose most powerusers would react the same
<Yoric[DT]>
It's not the matter of using ocamlfind.
<bluestorm>
hm
<Yoric[DT]>
It's the matter of using ocamlfind + having to write "use Batteries.Standard".
<Yoric[DT]>
That's one too many :)
<flux>
I think the best option still might be adding a new command line option to ocamlc that allows adding "open" to all compiled files
<flux>
although that still requires patching atleast ocamlc and friends, possibly ocamlfind
<Yoric[DT]>
flux: a patch to that effect has been on the bugtracker since 2005.
<flux>
yoric[dt], so, it would just be a bug fix, perfect :)
<Palace_Chan>
to quickly define an anonymous combine function which combines some two ints to make a third is the syntax: (fun f x y -> x+y) ?
<bluestorm>
no "f"
<bluestorm>
(fun x y -> x + y)
<bluestorm>
but (+) does the same
<bluestorm>
(+) is the function corrresponding to the infix operator +
<Palace_Chan>
ah ok, thanks (i was getting compile error
<Yoric[DT]>
Well, anyway, we can survive with ocamlfind + "use Batteries.Standard" until version 0.1+.
Proteus__ has quit [Read error: 113 (No route to host)]
<ertai>
Yoric[DT]: pong
<Yoric[DT]>
ertai: question sent by e-mail :)
<Yoric[DT]>
(and bluestorm may have answered it anyway)
<ertai>
Yoric[DT]: answered by mail
<Yoric[DT]>
Thanks
<ertai>
For others (untested one-liner extension): AstFilters.register_str_item_filter (fun st -> <:str_item< open Foo; $st$ >>);;
<Yoric[DT]>
What do I need to open for that?
<Yoric[DT]>
Any functor?
Proteus_ has quit [Read error: 113 (No route to host)]
<ertai>
Yoric[DT]: no Camlp4.PreCast should suffice
<Yoric[DT]>
ok
<Yoric[DT]>
thanks
mbishop has quit [Remote closed the connection]
Proteus has quit [Read error: 113 (No route to host)]
mfp has quit [Read error: 110 (Connection timed out)]
mfp has joined #ocaml
rwmjones has quit [Read error: 104 (Connection reset by peer)]
Linktim_ has joined #ocaml
Snark has quit ["Ex-Chat"]
tomh_-_ has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
_y_ has joined #ocaml
<_y_>
I'm reading an OCaml codebase atm, and I see the following term: "~-1" ... playing around with the interpreter, I can't see any difference between this and "-1"
<_y_>
what's the purpose of this?
<Eridius>
huh, I wonder what that means
<flux>
let foo a b = a + b;;
<flux>
foo -1 -2;; -> illegal
<flux>
foo ~-1 ~-2 -> ok
<Eridius>
huh
<Eridius>
curious syntax
<_y_>
thank you flux
<flux>
foo -1 -2 is the same as foo - 1 - 2, obviously
<flux>
so to differentiate there is an additional syntax
<flux>
most of the time I might just use foo (-1) (-2), though
<flux>
but, it gets worse :P, behold! ~-.1.0
<Eridius>
...wtf?
<Eridius>
oh, negation for floats is -.? I never thought about that
itewsh has joined #ocaml
jeddhaberstro has joined #ocaml
ygrek has quit [Remote closed the connection]
Ched- has quit [Read error: 60 (Operation timed out)]
Ched- has joined #ocaml
middayc has joined #ocaml
Proteus has joined #ocaml
Proteus_ has joined #ocaml
Proteus has quit [Read error: 104 (Connection reset by peer)]
maattd has quit ["Leaving."]
Linktim_ has quit ["Quitte"]
Proteus__ has joined #ocaml
Proteus_ has quit [Success]
hkBst has joined #ocaml
tomh_-_ is now known as tomh-
tomh- is now known as tomh
sporkmonger has quit []
<Palace_Chan>
why does this: "let (<@) (a : int32) (b : int32) : bool = if (Int32.compare a b) < 0 true else false"
<Palace_Chan>
give me a syntax error ?
<Eridius>
you're missing "then"
<Palace_Chan>
Eridius, AH totally forgot
seafood has joined #ocaml
Proteus__ has quit [Read error: 113 (No route to host)]
<bluestorm>
Palace_Chan:
<bluestorm>
"if foo then true else false" looks like suboptimal
<bluestorm>
(as does "then false else true" or "then ... else true" or any other occurence of "[then/else] [true/false]")
<Palace_Chan>
bluestorm, what would be optimal ?
<Eridius>
Palace_Chan: stripping the if and leaving the condition
<Eridius>
just say Int32.compare a b
<Eridius>
err, < 0
<Palace_Chan>
oh because the expression evaluates to bool anyways
<Yoric[DT]>
yep
<Yoric[DT]>
bluestorm: if you're interested, I just updated the documentation.
marmotine has quit ["mv marmotine Laurie"]
jlouis has quit ["Leaving"]
seafood has quit []
Proteus has joined #ocaml
itewsh has quit [Read error: 113 (No route to host)]
Proteus_ has joined #ocaml
bluestorm has quit [Remote closed the connection]
Proteus has quit [Read error: 113 (No route to host)]