<orbitz>
Yeah the haskell article didn't really scream "practical" to me :)
<flux>
I wonder how one actually generates such trees in a type-safe manner.. I guess you just push the errors closer to the generator part. maybe it's good.
boscop has quit [Ping timeout: 246 seconds]
mcclurmc has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 246 seconds]
ikaros has joined #ocaml
pheredhel` has joined #ocaml
joewilliz has joined #ocaml
yroeht_ has joined #ocaml
vivanov has joined #ocaml
rproust_ has joined #ocaml
bzzbzz_ has joined #ocaml
joewilliams_away has quit [Ping timeout: 240 seconds]
Cyanure has quit [Remote host closed the connection]
Cyanure has joined #ocaml
Kakadu has quit [Quit: Page closed]
myu2 has joined #ocaml
<sgnb>
vivanov: oasis should become installable at next mirror push
vivanov has quit [Quit: Lost terminal]
Cyanure has quit [Remote host closed the connection]
yezariaely has joined #ocaml
dnolen has quit [Quit: dnolen]
Snark has joined #ocaml
jderque has quit [Quit: Leaving.]
<kaustuv>
orbitz: GADTs can allow you to reflect "computations" as data, which can let you do lots of interesting things such as partial evaluation.
<kaustuv>
For example (notation is not precise):
<kaustuv>
type _ monad with
<kaustuv>
Return : 'a. 'a -> 'a monad
<kaustuv>
Bind : 'a 'b. 'a monad * ('a -> 'b monad) -> 'b monad
ccasin has quit [Quit: leaving]
ymasory has joined #ocaml
rien has quit [Ping timeout: 260 seconds]
rien has joined #ocaml
<kaustuv>
I guess I mean s/reflect/reify/ to be accurate
<orbitz>
are you sayin gi can get first class continuations with GADTs?
ccasin has joined #ocaml
<kaustuv>
No, the computations that you can reify this way must already have good algebraic properties (such as purity or monad/comonad laws), so you can't turn arbitrary OCaml computations into data
<orbitz>
ok
<kaustuv>
Well, I don't actually know what I'm talking about. It's just an idea I've been trying, so far unsuccessfully, to get to work in Haskell
Associat0r has joined #ocaml
jonafan has joined #ocaml
thomasga has joined #ocaml
yezariaely has left #ocaml []
rien has quit [Ping timeout: 252 seconds]
rien has joined #ocaml
andreas1 has joined #ocaml
<andreas1>
Hi!
<andreas1>
I've been playing around with BatInt.Safe_int for a bit.
<andreas1>
And it seems to break other code, it is not a drop-in replacement.
<andreas1>
Now there is code that uses = to compare instances of char.
<andreas1>
Any idea on what to do to avoid this breakage?
<mfp>
open BatInt.Safe_int let (=) = Pervasives.compare
<andreas1>
Will that break my ability to compare integers?
<mfp>
no, int is a particular case of 'a ;-)
<mfp>
# Pervasives.compare;;
<mfp>
- : 'a -> 'a -> int = <fun>
<andreas1>
So much for the theory.
<andreas1>
In practice, it breaks code.
<andreas1>
Just tried...
<mfp>
what does it break?
<mfp>
oops brainfart
<mfp>
of course, it must be let (=) x y = Pervasives.compare x y = 0
joewilliz is now known as joewilliams
joewilliams has quit [Changing host]
joewilliams has joined #ocaml
<andreas1>
Ha! Works like a charm!
<andreas1>
Thanks!
<andreas1>
(but why does Safe_int define (=) at all, if that is neither needed nor working?)
<mfp>
I suppose it's defined monomorphically for performance reasons
diml has joined #ocaml
<andreas1>
Isn't the type checker supposed to resolve the polymorphism at compile time anyways?
boscop has joined #ocaml
avsm has quit [Quit: Leaving.]
<mfp>
well, the original functions are polymorphic, but Safe_int defines monomorphic operators that only work on Safe_int.t (BatInt does the same btw)
joewilliams is now known as joewilliams_away
boscop has quit [Ping timeout: 250 seconds]
joewilliams_away is now known as joewilliams
<andreas1>
mfp: I just don't understand why one would make it monomorphic. But anyways, that might be a discussion for a later time, I need to run. Thanks again.
andreas1 has quit [Quit: Leaving.]
<kaustuv>
calling caml_int_compare instead of %compare is measurably faster?
vivanov has joined #ocaml
<sgnb>
kaustuv: yes (same holds for caml_string_compare)
Tianon has quit [Ping timeout: 260 seconds]
ftrvxmtrx has quit [Quit: Leaving]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
<thelema>
batteries should have an openable module that makes ints safe without replacing (=)
eikke has quit [Ping timeout: 246 seconds]
jderque has joined #ocaml
jderque has quit [Client Quit]
ygrek has joined #ocaml
Yoric has left #ocaml []
andreas has joined #ocaml
thomasga has quit [Quit: Leaving.]
Hyper-Core has joined #ocaml
vivanov has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
larhat has quit [Quit: Leaving.]
vivanov has joined #ocaml
Hyper-Core has left #ocaml []
ftrvxmtrx has joined #ocaml
lopex has quit [Ping timeout: 252 seconds]
Yoric has joined #ocaml
boscop has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
jamii has quit [Ping timeout: 246 seconds]
Associat0r has quit [Quit: Associat0r]
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
Associat0r has joined #ocaml
DimitryKakadu has joined #ocaml
Associat0r has quit [Quit: Associat0r]
Associat0r has joined #ocaml
Snark has quit [Quit: Ex-Chat]
<vivanov>
how to avoid error "When using -syntax, the META variable 'preprocessor' must be set" when running $ocamlfind ocamldep -package threads -package batteries -syntax camlp4o -modules foo.ml
<hnrgrgr>
vivanov: remove "-syntax camlp4o" or add a package that is a syntax extension
<hnrgrgr>
for example -package batteries.syntax
<vivanov>
doing now
<vivanov>
hnrgrgr: thanks -- that worked -- but now another error appeared Uncaught exception: DynLoader.Error ("pa_llist.cmo", "file not found in path")
myzt has joined #ocaml
rien has quit [Ping timeout: 276 seconds]
rien has joined #ocaml
boscop has joined #ocaml
kakadu has joined #ocaml
avsm has quit [Quit: Leaving.]
ymasory has quit [Quit: Leaving]
jamii has joined #ocaml
<thelema>
vivanov: is there a pa_llist.cmo file installed by batteries?
<thelema>
hmm, maybe we're forgetting to install that. Good catch.
philtor has joined #ocaml
<thelema>
try copying your batteries/_build/src/syntax/pa_llist/pa_llist.cmo to `ocamlfind query batteries`
<vivanov>
thelema: you're right -- it's not there
<thelema>
I just pushed the change to install it on make install
<vivanov>
thelema: yes -- that fixed that
<thelema>
thanks for reporting the bug
<vivanov>
:) thanks for help with that
<thelema>
vivanov: if you're not planning on using the syntax extensions (as you may guess, many batteries devs don't), you can omit the -syntax camlp4o
Kakadu|2 has joined #ocaml
Kakadu|2 has quit [Client Quit]
strlen has quit [Ping timeout: 248 seconds]
<vivanov>
thelema: ok
<andreas>
Hmmm. I"m having trouble making simple things work. Like printf from Batteries.
<andreas>
What I can do is opening the top level, and saying:
<andreas>
#use "topfind";;
<andreas>
#require "batteries";;
boscop has quit [Ping timeout: 246 seconds]
<andreas>
Then I can go on with:
<andreas>
open BatPrint;;
<andreas>
printf then is bound.
<andreas>
However, the syntax for format string args, i.e. p"foo", is not.
<andreas>
When trying to compile a file, I can't use the topfind magig.
<andreas>
And so it doesn't work there at all.
<thelema>
use the ocamlinit file included in batteries to fully integrate batteries and all its syntac extensions into your toplevel
<andreas>
ah!
strlen has joined #ocaml
<thelema>
for compilation, use ocamlfind ocamlopt -package batteries.syntax -syntax camlp4o ...
<thelema>
it is troublesome that what works on the command line doesn't work in the top level and vice versa
<andreas>
Yep.
<andreas>
But hey, there's documentation and help in this channel, no reason to complain. :)
<thelema>
the documentation needs much more work, and this channel is often quiet.
<thelema>
but we're working on improvements
ymasory has joined #ocaml
kakadu has quit [Remote host closed the connection]
mnabil has joined #ocaml
andreas has quit [Quit: Leaving.]
andreas has joined #ocaml
Yoric has quit [Ping timeout: 260 seconds]
ymasory has quit [Quit: Leaving]
Yoric has joined #ocaml
DimitryKakadu has quit [Remote host closed the connection]
philtor has quit [Ping timeout: 252 seconds]
<andreas>
What is the difference between use Batteries and use Batteries_uni, and why does one work with the toplevel, but only the other with the compiler?
eikke has joined #ocaml
lopex has joined #ocaml
edwin has quit [Remote host closed the connection]
<alpounet>
iirc uni is the unicode version
<andreas>
That makes it arbitrarily weird.
jamii has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 246 seconds]
ulfdoz has quit [Read error: Operation timed out]
<eikke>
does ocaml have something like hoogle (including the type-based search)?
lopexx has joined #ocaml
lopex has quit [Ping timeout: 246 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
philed has quit [Remote host closed the connection]
boscop has joined #ocaml
<andreas>
Ok. So Batteries printf works for me from the top level.
<andreas>
What's the right thing to do for compilation?
<thelema>
alpounet: uni = uni-thread - no threads
<andreas>
I take that back, it doesn't work on the toplevel either.
<andreas>
thelema: ah!
<alpounet>
ohhh
<alpounet>
right
<thelema>
andreas: there's no equivalent for #install_printer for compilation - there's no return value being auto-printed
<andreas>
I see.
<andreas>
# printf p"{%{char}}" 'a';;
<andreas>
# Error: Unbound value char_printer
<andreas>
This is my problem.
<thelema>
andreas: the closest there is is Char.print / Uchar.print
<thelema>
I'm surprised by the "unbound value", as char_printer should be defined in BatPervasives, which is opened by default
<thelema>
andreas: thanks for the bug report on the pa_llist install filename
<andreas>
btw., in the Getting Started in the Wiki, it suggests to use "ocamlfind ocamlc -package batteries.syntax", where in fact I had to use "ocamlfind ocamlc -package batteries -package batteries.syntax"
<andreas>
Hmm. batPervasives.ml defines a "output_char", not "char_printer".
<thelema>
andreas: can you edit?
<andreas>
Yes.
<thelema>
use your best judgement to fix things. If you get the p"{%{char}}" thing working, put it on that page as an example with syntax extensions
pantsd has quit [Ping timeout: 260 seconds]
<andreas>
oh. batPervasives.mli defines a bunch of *_printer. There's bool_printer, int_printer, etc.
<andreas>
But no char_printer. :)
<thelema>
Well, if it's actually useful, you're welcome to send a patch. It's probably a pretty trivial patch.
<andreas>
I guess so. I'll make it work (even if not tonight anymore).
<andreas>
Thanks for your help!
<thelema>
you're welcome
mnabil has quit [Read error: Operation timed out]
Amorphous has quit [Ping timeout: 246 seconds]
Yoric has quit [Quit: Yoric]
mnabil has joined #ocaml
Amorphous has joined #ocaml
lopexx has quit []
sepp2k has quit [Quit: Leaving.]
wagle has quit [Read error: Connection reset by peer]