<zozozo>
companion_cube: actually using flambda to *prevent* any optimization works and lets one see the sharing of code pointers, which is kinda cool
rgrinberg has joined #ocaml
al-damiri has joined #ocaml
ryanartecona has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 250 seconds]
ryanartecona has quit [Client Quit]
jao has joined #ocaml
apache2 is now known as apache3
<freehck>
Hello. How could I specify module alias in .mli file?
jao has quit [Ping timeout: 256 seconds]
<Drup>
module A = B
<freehck>
Drup: in .mli ?
<freehck>
I get "Syntax error inside `recursive module', expecting `;;' or module declaration"
<Drup>
freehck: yes, inside an .mli, can you show your example ?
<companion_cube>
freehck: first, check that you have 4.02 or more recent
<freehck>
4.01.0 )
TarVanimelde has quit [Quit: TarVanimelde]
<companion_cube>
module aliases didn't exist back then, I think
<Drup>
yeah, module aliases are >=4.03
<Drup>
4.02
<freehck>
k, thank you pals :)
<Drup>
freehck: if you want to export the fact that a module has the same types as another with ocaml < 4.02, you can do "module A = module type of struct include B end"
<Drup>
(the "struct include .. end" thing is to export equalities to types in the B module)
<freehck>
Drup: can't understand what does mean "of" in "module type of struct include Kernel_Mods end".
<Drup>
"module type of M" is the module type of M :D
<Drup>
it's part of the syntax
<freehck>
Hm... Seems I've just forgot.
<freehck>
Well it works. Cool.
<freehck>
Drup: Do I understand correctly: before 4.02 I must type this magic in .mli, and after 4.02 I can use module A = B right in .mli file?
ggherdov has quit []
<Drup>
yes, but the semantics is not exactly the same
<freehck>
And what's the difference?
<Drup>
the version I gave you doesn't say that modules are the same, it says that A has the same API as B, and all the types are equals
<Drup>
it doesn't say that A = B, which is a much stronger assertion
ggherdov has joined #ocaml
johnf_ has quit [Read error: Connection reset by peer]
<Drup>
(but in most cases, the weaker assertion is enough)
orbifx has joined #ocaml
johnf_ has joined #ocaml
sh0t has joined #ocaml
ryanartecona has joined #ocaml
<companion_cube>
Drup: or just `module type of B`
<Drup>
companion_cube: nope, not the same
<Drup>
it will not export that A.t = B;t
<companion_cube>
hmmmmmmmm
<companion_cube>
funny
<Drup>
yeah, "funny"
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Ping timeout: 265 seconds]
thizanne has quit [Ping timeout: 260 seconds]
Orion3k has quit [Quit: Leaving]
Orion3k has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
smondet has quit [Ping timeout: 258 seconds]
sh0t has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #ocaml
ryanartecona has joined #ocaml
ciniglio has quit [Ping timeout: 260 seconds]
kakadu has joined #ocaml
orbifx has quit [Ping timeout: 260 seconds]
yomimono has quit [Ping timeout: 246 seconds]
sh0t has joined #ocaml
noddy has quit [Ping timeout: 260 seconds]
AltGr has left #ocaml [#ocaml]
slash^ has quit [Quit: Leaving]
smondet has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
_andre has quit [Quit: leaving]
michbad has joined #ocaml
yomimono has joined #ocaml
Madars has quit [Ping timeout: 250 seconds]
ocaml456 has joined #ocaml
pierpa has quit [Remote host closed the connection]
ygrek has joined #ocaml
pierpa has joined #ocaml
ocaml456 has quit [Quit: Page closed]
Madars has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
jao has joined #ocaml
djellemah_ has quit [Quit: Leaving]
djellemah_ has joined #ocaml
AlexDenisov has joined #ocaml
AlexDeni_ has joined #ocaml
AlexDenisov has quit [Ping timeout: 246 seconds]
ryanartecona has quit [Quit: ryanartecona]
demonimin has quit [Remote host closed the connection]
demonimin has joined #ocaml
FreeBirdLjj has joined #ocaml
jnavila has joined #ocaml
d0nn1e has quit [Ping timeout: 248 seconds]
marsam has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
d0nn1e has joined #ocaml
madroach has joined #ocaml
nicholasf has joined #ocaml
<dmbaturin>
What's the proper way to use Lwt loggers? Lwt_log.file etc. are ... -> Lwt_log.logger Lwt.t while Lwt_log.log logger argument is Lwt_log.logger
kakadu has quit []
<aantron>
dmbaturin: let%lwt logger = Lwt_log.file ~file_name:"foo" () in (* here logger : Lwt_log.logger *)
<aantron>
or open Lwt.infix Lwt_log.file ~file_name:"foo" () >>= fun logger -> (* again, logger : Lwt_log.logger *)
<aantron>
Lwt.Infix*
trepta7 has joined #ocaml
<dmbaturin>
aantron: Absolutely no way to avoid passing it around all the time?
djellemah has quit [Disconnected by services]
djellemah_ is now known as djellemah
djellemah_ has joined #ocaml
marsam has quit [Read error: Connection reset by peer]
<copy`>
You can use Lwt_nmai
<copy`>
Whoops. You can use Lwt_main.run
<copy`>
I'm not entirely sure if it's legal to use it twice though
michbad has quit [Remote host closed the connection]
<aantron>
dmbaturin: if you want some complex logging with destinations based on section and level, but don't want to pass it around, you can construct a fancy logger with Lwt_log.dispatch and then assign that to Lwt_log.default
<aantron>
i dont know what Lwt_core is in the docs of Lwt_log.default.. have to remove that. pretend it's not there :)
<dmbaturin>
aantron: Oh, log_default is a ref. Yeah, that's what I need really, thanks.
<aantron>
yeah. should emphasize that.
ocabot has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
ciniglio has joined #ocaml
<dmbaturin>
aantron: I think lwt docs could seriously benefit from some examples.
<aantron>
yeah. ive been amassing an enormous todo list for that
<aantron>
whatever you come across that sucks in the docs, please point it out. even though one could probably complain about almost every function and type :p
larhat has joined #ocaml
thizanne has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
pyon has quit [Quit: Unyu~?]
agarwal1975 has quit [Quit: agarwal1975]
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
<dmbaturin>
aantron: Could you show me an example of how you'd update that reference so that everything is happy with the types?
yomimono has quit [Ping timeout: 246 seconds]
ocabot has quit [Remote host closed the connection]
<aantron>
dmbaturin: once you have a Lwt_log.logger "logger", you should be able to just do Lwt_log.default := logger;
<aantron>
im guessing the difficulty is having the Lwt_log.logger. if you are using something like Lwt_log.file to get it, you have to do the reference update on the right side of a bind, i.e. after let%lwt or >>=
noddy has joined #ocaml
<aantron>
otherwise please tell what error you are getting
AlexDeni_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexDenisov has joined #ocaml
<aantron>
so Lwt_log.file "foo.log" () >>= fun logger -> Lwt_log.default := logger; Lwt.return_unit
AlexDenisov has quit [Client Quit]
gregoire has quit [Ping timeout: 245 seconds]
AlexDenisov has joined #ocaml
<aantron>
or if you want to get fancier, Lwt_log.file "foo.log" () >|= (:=) Lwt_log.default :p
jnavila has quit [Ping timeout: 260 seconds]
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
smondet has quit [Ping timeout: 250 seconds]
AlexDenisov has quit [Client Quit]
AlexDenisov has joined #ocaml
Simn has quit [Read error: Connection reset by peer]
<companion_cube>
I admire aantron's overall patience with lwt
<dmbaturin>
I don't get why the assignment in the None case doesn't cause errors.
zpe has quit [Ping timeout: 258 seconds]
ciniglio has quit [Ping timeout: 258 seconds]
<dmbaturin>
Anyway, if I try it in a bind, I get This expression has type Lwt_log.logger = Lwt_log_core.logger but an expression was expected of type 'a Lwt.t
<dmbaturin>
Oh, ok, the docs actually do say syslog and file are different type, and syslog is logger while file is logger Lwt.t
<dmbaturin>
But, why?
noddy has quit [Ping timeout: 250 seconds]
Exagone313 has quit [Quit: see ya!]
propane has quit [Ping timeout: 260 seconds]
Soni has joined #ocaml
TarVanimelde has joined #ocaml
pyon has joined #ocaml
Exagone313 has joined #ocaml
freusque has quit [Ping timeout: 268 seconds]
Soni is now known as propane
silver has quit [Read error: Connection reset by peer]
silver_ has joined #ocaml
silver_ has quit [Remote host closed the connection]
zirman has quit [Ping timeout: 256 seconds]
smondet has joined #ocaml
<aantron>
dmbaturin: you would need something like this (a sketch): 1. the match case will evaluate to Lwt.return_unit in both branches
<dmbaturin>
aantron: Yeah, that's what I did. But why syslog and file are different type?
<aantron>
oh ok cool
<aantron>
for this i don't have an immediate answer, beyond conjecture: that the promise created by file blocks until the file is actually opened, but the syslog call assumes that it will be able to log to the syslog socket
<aantron>
going to glance at the code, hope its not totally awful :p
<aantron>
looks essentially arbitrary, without looking at it very deeply. Lwt_log.file happens to wrap its final result in Lwt.return, otherwise it could just evaluate to a logger
<aantron>
ah not quite
<aantron>
anyway yeah, Lwt_log.file does wait until the file is open. it's not really clear to me that Lwt_log.syslog shouldn't wait to connect to the syslog socket, would have to take a closer look. and document either way
<aantron>
(by waits, and blocks, i mean the Lwt.t promise of course, not the OCaml process or system threads :) )
<aantron>
companion_cube: :p
<dmbaturin>
aantron: Yeah, I see what you mean. Also, channel is simply logger too.
<aantron>
channel seems like the most defensible for evaluating to a promise, as the channel is already open. but there is also something to be said for consistency. or at least documentation :)
<dmbaturin>
Also, which package provides the ppx extension?
<aantron>
lwt.ppx
<aantron>
(if we're talking about ocamlfind packages. it's the same opam package, lwt)
<dmbaturin>
I used the raw bind so far, but I guess the extension could be handy. I just wonder why I don't have that ocamlfind package if I installed lwt from opam. :)
<aantron>
hmmm. what does your ocamlc -version say?
<dmbaturin>
I have two active switches now, 4.02.3 and 4.03.0. Just checked, neither can find lwt.ppx
<aantron>
what about ppx_tools?
<aantron>
is it installed in these switches?
sepp2k has quit [Quit: Leaving.]
<dmbaturin>
It's installed indeed.
<aantron>
and the lwt version? opam list lwt
<dmbaturin>
2.4.5
<aantron>
ok thats why
<aantron>
either you have not run opam update since mid-2014 :p or there is a conflict with something that requires old lwt. opam install lwt.2.6.0 should show what it is i think
<aantron>
not sure if you would have to do opam remove lwt first
<dmbaturin>
I have... Strange.
<Enjolras>
either you are running opam without aspcud
<Enjolras>
i don't know why but opam internal solver keeps installing me 2.4 as a dependency
<Enjolras>
like opam install utop -> installs 2.4
<dmbaturin>
Without ascpud, that's possible. I'll check.
<dmbaturin>
Enjolras: Provided I installed all the stuff in 4.03 through opam switch import, I guess that's a likely scenario.
<Enjolras>
opam should warn you if you don't have ascpud
<Enjolras>
ah you mean you might have imported a switch installed without aspcud ? Not sure how that behaves :)
zirman has joined #ocaml
zirman has joined #ocaml
zirman has quit [Changing host]
<Enjolras>
aantron: you can do opam upgrade lwt to force an upgrade of a specific package
<aantron>
ah, good, thanks
<Enjolras>
(and for remove/install there is the reinstall shortcut :) )
<Enjolras>
that does not upgrade as far as i know
<aantron>
wasnt sure how they interact with giving a specific version number :)
FreeBirdLjj has joined #ocaml
<Enjolras>
dmbaturin: you should at least check you have aspcud now. Else you will run into similar issues frequently
FreeBirdLjj has quit [Remote host closed the connection]
<Enjolras>
opam without external solvers is alpha quality. It does not really work
FreeBirdLjj has joined #ocaml
<dmbaturin>
Enjolras: Yeah, I need to check my setup. But, tomorrow, after I get some sleep.
<Enjolras>
:)
<aantron>
Enjolras: opam on cygwin without aspcud was simply crashing, probably stack overflow
<aantron>
this happened one day when the repo got bigger
zirman has quit [Ping timeout: 246 seconds]
<Enjolras>
aantron: that's better. At least it is obvious that it is broken !