adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.02.3 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
_berke_ has joined #ocaml
_berke_ has quit [Client Quit]
_berke_ has joined #ocaml
M-Illandan has quit [Remote host closed the connection]
sspi_ has joined #ocaml
msch_ has joined #ocaml
keteim has quit [Ping timeout: 240 seconds]
kamog has quit [Ping timeout: 240 seconds]
sspi has quit [Ping timeout: 240 seconds]
msch has quit [Ping timeout: 240 seconds]
keteim has joined #ocaml
kamog has joined #ocaml
sspi_ is now known as sspi
<aantron> Drup, i was thinking of having markup.ml parse DTD in the future. could that be somehow useful for generating modules and type definitions?
msch_ is now known as msch
<aantron> i am not familiar with how tyxml encodes DTDs and what it encodes from them
<Drup> we don't use dtd
<Drup> and we don't handle them
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
<Drup> there is an issue on the subject, but I'm not interested in working on the subject, and nobody else seems.
<Drup> (and frankly, I have yet to see a use of dtd in the wild)
<aantron> what i meant is, your types implicitly constrain construction. perhaps to some extent, for xml languages other than svg and xhtml, we could generate modules with types and values that implicitly encode some constraints of any given DTD
<aantron> fair enough
<aantron> i havent either :)
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
<Drup> I don't know the dtd spec enough to know if it's encodable in ocaml's typesystem
<Drup> Given the little I know about it, I highly doubt it
<Drup> That still would be a huuuge work
<Drup> (The encoding of the html spec is highly non trivial)
M-Illandan has joined #ocaml
nekrodesk has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
<pgiarrusso> Academically speaking, you might be interested in OcamlDuce: http://www.cduce.org/ocaml.html
madroach has joined #ocaml
<pgiarrusso> (for dealing with XML)
Kakadu has quit [Remote host closed the connection]
<Drup> in theory, yes, in practice, it's a modified version of a 4 years old ocaml version ^^
nkhodyunya has quit [Quit: Leaving.]
Guest38 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<pgiarrusso> yeah, I feared so (hence “academically”). But they certainly looked into “what type system we need for doing XML right”, so their papers might help understand the issue, for theoretically-inclined.
teknozulu has joined #ocaml
nkhodyunya has joined #ocaml
AltGr has joined #ocaml
orbifx has quit [Quit: WeeChat 1.3]
nkhodyunya has quit [Quit: Leaving.]
aantron has quit [Remote host closed the connection]
dksong has joined #ocaml
dksong has quit [Ping timeout: 272 seconds]
nkhodyunya has joined #ocaml
crass has quit [Remote host closed the connection]
pierpa has quit [Ping timeout: 252 seconds]
struk|desk has joined #ocaml
nkhodyunya has quit [Quit: Leaving.]
nkhodyunya has joined #ocaml
nkhodyunya has quit [Client Quit]
nkhodyunya has joined #ocaml
damason has quit [Quit: I must go; My people need me.]
damason has joined #ocaml
dksong has joined #ocaml
dksong has quit [Ping timeout: 250 seconds]
aantron has joined #ocaml
caml_hump has joined #ocaml
kgbounce has joined #ocaml
caml_hump has quit [Ping timeout: 252 seconds]
kamog has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.39/20160205064158]]
kgbounce has quit [Ping timeout: 252 seconds]
t4nk075 has joined #ocaml
<t4nk075> Hello everyone I have a quick question: if a function is defined with two parameters and later used with just one param, it means the other param is implicitly curried, correct?
<aantron> the function with two parameters is what is "curried", meaning that applying it to only one argument gives you another function expecting the second argument
<aantron> so yes
t4nk075 has quit [Ping timeout: 252 seconds]
nekrodesk has quit [Max SendQ exceeded]
teknozulu has quit [Ping timeout: 252 seconds]
<icicled> is there any way to tell merlin to ignore ppx_lwt syntax?
<icicled> or must I use the p4 extension?
crass has joined #ocaml
<Drup> ignore ?
<Drup> you mean, handle ? just add "PKG ppx.lwt" to your .merlin
struk|desk is now known as struk|desk|away
dksong has joined #ocaml
<icicled> ah
<icicled> I also needed EXT lwt
<icicled> thanks!
<Drup> lwt.ppx*
<Drup> You don't need EXT lwt with the ppx
<Drup> that's for the camlp4 version only
<icicled> if I don't put that line it shows "Syntax error inside `try', expecting <attr_id>"
<icicled> for `try%lwt`
<icicled> with both lines it works
struk|desk|away is now known as struk|desk
dksong has quit [Ping timeout: 240 seconds]
f[x] has quit [Ping timeout: 250 seconds]
<icicled> removed `EXT lwt` & did merlin-restart - that fixed it
nkhodyunya has quit [Quit: Leaving.]
crass has quit [Remote host closed the connection]
struk|desk is now known as struk|desk|away
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
nekrodesk has joined #ocaml
jeffmo has quit [Quit: jeffmo]
nuuit has quit [Ping timeout: 240 seconds]
kushal has joined #ocaml
abbiya has joined #ocaml
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
mietek has quit [Ping timeout: 252 seconds]
nekrodesk has quit [Excess Flood]
mietek has joined #ocaml
seangrove has joined #ocaml
<seangrove> Just double checking (I don't see anything from google/github/opam), anyone know of a liquid templating parser in ocaml?
<def`> I cannot help, but out of curiosity, what is liquid templating?
<seangrove> Very popular syntax used for making templates
<seangrove> Originated in ruby-land from Spotify, I think
<seangrove> Err, Shopify, rather
<seangrove> I'll work on one with menhir, should be a good learning experience
dksong has joined #ocaml
dksong has quit [Ping timeout: 245 seconds]
gustav__1 has quit [Ping timeout: 240 seconds]
copy` has quit [Quit: Connection closed for inactivity]
gustav___ has joined #ocaml
MercurialAlchemi has joined #ocaml
seangrove has quit [Ping timeout: 248 seconds]
Algebr has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
nicoo has quit [Ping timeout: 248 seconds]
nicoo has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 240 seconds]
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
MercurialAlchemi has joined #ocaml
nekrodesk has joined #ocaml
nekrodesk has joined #ocaml
AltGr has left #ocaml [#ocaml]
AltGr has joined #ocaml
kushal has quit [Ping timeout: 248 seconds]
kushal has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
wolfcore has quit [Ping timeout: 240 seconds]
_berke_ has quit [Ping timeout: 248 seconds]
wolfcore has joined #ocaml
_berke_ has joined #ocaml
accname has joined #ocaml
accname has quit [Ping timeout: 252 seconds]
dksong has joined #ocaml
julien_t has joined #ocaml
<julien_t> Hi there !
<julien_t> I have a problem with week types and I can't figure out how to solve it :/
dksong has quit [Ping timeout: 272 seconds]
<julien_t> Is there a way to force a weak type to be strongly polymorphe using Obj.magic ?
kamog has joined #ocaml
kushal has quit [Ping timeout: 240 seconds]
<julien_t> if i write let x : ( 'a ->unit ) = Obj.magic (e) where a is type ('_a -> unit) then x still has the type '_a -> unit. I expected that Obj.magic would force it to the polymorphic form
<zozozo> julien_t: if you use Obj.magic, and it is still not enough, I think there is something wrong somewhere, :p
dksong has joined #ocaml
<julien_t> indeed, there must be something wrong .... somewhere :p
<julien_t> I will try to produce a minimal example ...
dksong has quit [Quit: Leaving.]
dksong has joined #ocaml
sigjuice has quit [Quit: ZNC - http://znc.in]
accname has joined #ocaml
sigjuice has joined #ocaml
<Algebr> How can I put a constraint in opam file that the system must be 64 bit
<julien_t> And here is a very minmal example
<julien_t> let res : ('a -> int )= Obj.magic(fun x -> 1)
<julien_t> res has here the type '_a -> int
yawnt has joined #ocaml
<julien_t> It's weird
nekrodesk has quit [Max SendQ exceeded]
dksong has quit [Quit: Leaving.]
kushal has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
silver has joined #ocaml
darkf has quit [Quit: Leaving]
Haudegen has joined #ocaml
dhil has joined #ocaml
malc_ has joined #ocaml
jgjl has joined #ocaml
kushal has quit [Read error: Connection reset by peer]
sepp2k has joined #ocaml
<orbitz> Does opam have a way to distinguish between a build-time dep and a runtime-dep?
<aantron> yes, with the {build} constraint
<orbitz> or rather, I have a dep that is required to build the package but it is not required after taht.
<orbitz> Ok, thanks
jacquev6 has joined #ocaml
<zozozo> julien_t: why not just do "let res x = 1" ?
larhat has quit [Quit: Leaving.]
dsheets has joined #ocaml
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
<julien_t> zozozo, this is a very minimal example, in my real code there is much more than (fun x -> 1), there are expression where I have to use partial applications (due to a library I use)
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
jwatzman|work has joined #ocaml
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
kushal has joined #ocaml
octachron has joined #ocaml
nekrodesk has joined #ocaml
nekrodesk has quit [Max SendQ exceeded]
<octachron> julien_t, Obj.magic is still a function, so it cannot go away with the value restriction
nekrodesk has joined #ocaml
<sspi> I'm trying to move from ocamlbuild to ocamlc, because I want try ocaml + effects
<sspi> however I get the error: Error: Error while linking build/Type_helper.cmo: Reference to undefined global `Env'
<sspi> anyone got any tips on how to solve this?
dsheets has quit [Remote host closed the connection]
<edwin> are you still using ocamlfind though? make sure you have all the -package and -linkpkg flags
<def`> octachron: humm, Indon't thinknthe value restriction affect Obj.magic
<edwin> and that you pass all the .cm* files needed for linking
_andre has joined #ocaml
<julien_t> is there a way to shortcut the type system on this restriction ?
<edwin> if you used ocamlbuild before look at _build/_log, it has all the ocamlc invocations with the right flags and files, although what is about ocaml+effects that prevents you from using ocamlbuild?
<sspi> edwin: it fails on camlp4 for me
<def`> octachron: rhs of the arrow is unconstrained and obviously covariant, the typer will generalize "'b", and you are free to constrain with a generalized type scheme
kushal has quit [Ping timeout: 250 seconds]
<sspi> julien_t: thanks I'll try that :)
jacquev6 has quit [Quit: jacquev6]
<def`> in two steps
<julien_t> sspi, my question was totally unrelated to your discussion.
<octachron> def`, if I am not mistaken, the typer will generalize 'b, but it is still in expansive mode, so it will only generalize type parameters within 'b in covariant position
<def`> julien_t: let res = Obj.magic (fun _ -> 1)
<sspi> julien_t: ah crap, that should have been edwin :) sorry!
<def`> julien_t: let res : 'a -> int = res
dsheets has joined #ocaml
<def`> octachron: yes, yes, hence the two steps. not elegant but it works
<julien_t> ok sspi, no pbm, I just wanted to be sure ;)
silver has quit [Quit: rakede]
<julien_t> thanks def` , I'll try this
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
kushal has joined #ocaml
AltGr has left #ocaml [#ocaml]
Kakadu has joined #ocaml
Simn has joined #ocaml
<Algebr> the way that opam makes decisions about packages based on their naming is incredibly frustrating when you don't exactly know it.
<Algebr> ie, - and numbers in path name
kamog has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.39/20160205064158]]
<Algebr> but I guess its okay since other package managers, like nix, do somethign similar.
demonimin has quit [Remote host closed the connection]
demonimin has joined #ocaml
accname has quit [Ping timeout: 260 seconds]
kushal has quit [Quit: Leaving]
kushal has joined #ocaml
<def`> naming?
larhat has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
lmaury has joined #ocaml
<Algebr> def`: like the package path in an opam repository
<def`> what kind of decision it takes based on the path?!
<def`> that doesn't sound like a good idea
<sspi> ocaml + effects working \o/
<Algebr> def`: like I couldn't do in the opam-repository/packages/ios-3.2,
malc_ has quit [Quit: leaving]
copy` has joined #ocaml
dhil has quit [Ping timeout: 272 seconds]
dsheets_ has joined #ocaml
dsheets has quit [Ping timeout: 272 seconds]
abbiya has quit [Quit: Leaving]
nekrodesk has quit [Remote host closed the connection]
dsheets_ has quit [Remote host closed the connection]
dsheets has joined #ocaml
foolishmonkey has quit [Quit: Leaving]
foolishmonkey has joined #ocaml
dsheets_ has joined #ocaml
dsheets has quit [Read error: Connection reset by peer]
larhat has quit [Quit: Leaving.]
larhat1 has joined #ocaml
Simn has quit [Read error: Connection reset by peer]
Simn has joined #ocaml
dsheets_ has quit [Remote host closed the connection]
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
esad has joined #ocaml
<Drup> For seangrove when he comes back : https://github.com/dsheets/blueprint
<Drup> (It's WIP)
<Drup> Algebr: I still don't understand what you mean by "decision based on path"
accname has joined #ocaml
yawnt has quit [Changing host]
yawnt has joined #ocaml
larhat1 has quit [Quit: Leaving.]
<Algebr> Drup: the opam repository makes assumptions it seems about the naming of a package based off of its name
<Algebr> like having a number after a . in the package name apparently instantly versions it instead of saying that the number is part of the packge name itself
<Drup> well, it doesn't really make assumption, the name of a package is defined has the name of the first directory after package/
<Drup> (iirc)
<Drup> Algebr: Ah, yes, that's how it's specified
<Algebr> yea, I didn't know that, heh. some odd debugging.
<Drup> You never looked at how opam-repository is organized ?
<Algebr> of course I have, but i didn't realize that /package/thing thing couldn't have a digit as part of its name
Sorella has quit [Quit: Connection closed for inactivity]
tane has joined #ocaml
larhat has joined #ocaml
larhat has quit [Client Quit]
dsheets has joined #ocaml
igoroliveira has joined #ocaml
<sspi> Drup: thanks
yawnt has quit [Ping timeout: 240 seconds]
dsheets has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 240 seconds]
jgjl has joined #ocaml
jgjl has quit [Client Quit]
dsheets has joined #ocaml
jgjl has joined #ocaml
abbiya has joined #ocaml
Haudegen has joined #ocaml
nkhodyunya has joined #ocaml
mstevens has joined #ocaml
yawnt has joined #ocaml
yawnt_ has joined #ocaml
silver has joined #ocaml
dhil has joined #ocaml
hcarty has joined #ocaml
esad has quit [Quit: Textual IRC Client: www.textualapp.com]
JacobEdelman_ has joined #ocaml
abbiya has quit [Quit: Leaving]
Sorella has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
_2can_ is now known as _2can
Haudegen has quit [Remote host closed the connection]
larhat has joined #ocaml
Haudegen has joined #ocaml
larhat has quit [Client Quit]
Haudegen has quit [Ping timeout: 276 seconds]
dksong has joined #ocaml
<julien_t> Doe's someone know if opam builds the documentation of ocaml, and if yes, where does it stoer it ?
dksong has quit [Ping timeout: 272 seconds]
mrvn has joined #ocaml
_berke_ has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
pierpa has joined #ocaml
jeffmo has joined #ocaml
<Drup> some package provide doc build instruction, which are used when you give the -d option to opam install
_andre has quit [Ping timeout: 240 seconds]
<Drup> it's not very common, unfortunatly
dhil has quit [Ping timeout: 245 seconds]
Haudegen has joined #ocaml
<Drup> as to "where ?", "opam config var <package>:doc"
_andre has joined #ocaml
<julien_t> I was thinking of the documentation of ocaml, not of packages
<julien_t> but it's interesting to know about this -d option
<icicled> julien_t: the docs for ocaml should be avilable if you're using opam
<icicled> man pages are generated - I didn't even know till I inspected the .opam folder
<icicled> useful to have - also there is a single text file you can download for the core language which has docs for all the modules as well - http://caml.inria.fr/pub/docs/manual-ocaml/ (at the top)
larhat has joined #ocaml
<julien_t> icicled, I am looking for the html manual of but can't find it in the .opam directory
<icicled> ah ok I don't think that one is built
<icicled> you can grab a zip of the html docs available online from the same url
<icicled> "bundle of HTML files"
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
crass has joined #ocaml
<julien_t> I like to have it on my computer as I often work offline, when I was working without opam, I had the doc compiled each time I built a new ocaml version
<julien_t> sure I could download it ... it's just that I was wondering if opam could have already done it for me :p
larhat has quit [Quit: Leaving.]
<Drup> julien_t: I think you should report it, it could be done
<Drup> (on opam repository)
jgjl has joined #ocaml
<julien_t> Ok, I put this in my todo list ...
MercurialAlchemi has quit [Ping timeout: 240 seconds]
BitPuffin has joined #ocaml
th5 has joined #ocaml
Kakadu has quit [Quit: Page closed]
mehdi_ has quit [Remote host closed the connection]
orbifx has joined #ocaml
toolslive has joined #ocaml
nkhodyunya has quit [Quit: Leaving.]
<orbifx> What functions does Lwt provide for blocking functions?
shinnya has joined #ocaml
<orbifx> Lwt.detach can only take one parameter..
larhat has joined #ocaml
<orbifx> I need more.
<Drup> :d
<orbifx> Lol
<orbifx> But is there a better approach than detach in general?
<orbifx> Or is that lwt's answer to blocking threads?
<Drup> Lwt_preemptive.detach is
<orbifx> In particular I have to two event loops which I want to run asynchronously.
ggole has joined #ocaml
<icicled> funny, I'm looking into the same issue now
dksong has joined #ocaml
dksong has quit [Client Quit]
<orbifx> :-D
<icicled> is it safe to use lwt streams from 2 different event loops?
<icicled> I need to send data from the non-lwt loop
<Drup> Lwt_preemptive.run_in_main
<Drup> (Not sure it's needed for Lwt_stream, though, it might not)
<orbifx> Any good tutorials on Lwt other than the one on the website?
<Drup> Not to my knowledge
<icicled> the pushing function has 'a -> () so I assume not - only one way to find out
<icicled> orbifx: I found this useful - http://baturin.org/code/lwt-counter-server/
<icicled> it's not a tutorial but an example
<orbifx> Thanks icicled, reading now.
<Drup> icicled: witch event look are you integrating with ?
<Drup> loop*
larhat has quit [Quit: Leaving.]
<mfp> orbifx, icicled: take a look at Lwt_unix.make_notification
<icicled> Drup: I'm using the postgresql package & the notifies feature - it sits there listening while using select and then consumes data on the socket
<icicled> and then should run my code & send data on lwt stream (my plan)
<icicled> I'm not sure if that is the right way to do it
<orbifx> mfp: mfp not sure if that helps my problem.
<Drup> icicled: what don't you just use pgocaml ? it's Lwt-compatible
<mfp> icicled, orbifx: like this http://paste.debian.net/381395/
<orbifx> mrvn: are you working on rewriting moc so that it's not needed for binding with ocaml?
nuuit has joined #ocaml
mehdi_ has joined #ocaml
<icicled> Drup: I need the postgresql notifications feature which I don't think pgocaml has
<mfp> orbifx: using Lwt_unix.make_notification you can e.g. have events from another event loop (running in a different thread) injected into a Lwt_stream, wasn't that what you were looking for?
<mrvn> orbifx: not realy. I'm writing bindings for QT widgets directly. no moc at all.
Algebr has quit [Ping timeout: 252 seconds]
<icicled> rather postgresql's listen/notify feature
<icicled> mfp: that would be me
larhat has joined #ocaml
<mfp> then the above should do
<icicled> what's the purpose of a queue + stream - why not just the stream?
<icicled> e.g. non-lwt loop gets the pusher function & the lwt one includes a lwt thread that reads from the stream
larhat has quit [Quit: Leaving.]
k1000 has quit [Ping timeout: 248 seconds]
<orbifx> mrvn: looking forward to your results. When will you have something?
<orbifx> mfp: I'm looking into how to have two asynchronous threads.
<mrvn> orbifx: you can already open a window.
k1000 has joined #ocaml
<mrvn> orbifx: next up is making callback work
<mfp> icicled: the non-lwt loop in another thread cannot just push into the stream, since that would wake up the sleepers in the current (non-Lwt) thread
<mfp> icicled: the queue + stream + notification dance is needed to avoid crossing the thread boundaries
<mrvn> orbifx: gonna try to make a button and then sockets work this weekend.
<sspi> Drup: any tips on how to get https://github.com/ocamllabs/ocaml-effects/pull/1 running? create a new opam remote - and link to that specific PR?
<Drup> yes
<Drup> unfortunatly, you can't (yet) pin compilers
<sspi> alright thanks - I'll do that :)
<Drup> So you need to create a custom repository
<Drup> minimal exemple here https://github.com/drup/drupam if you need one
<sspi> no worries, I'll fork the one from ocamllab - and do my changes there
<sspi> ah that could also work :)
dsheets has quit [Remote host closed the connection]
<icicled> mfp: ok that makes sense - thanks for pointing that out
<icicled> is that on the lwt docs someplace?
<mfp> I don't know if there's anything besides the lwt_unix.mli interface
<mfp> I believe I learned that by reading lwt_preemptive.ml
<orbifx> mrvn: are you changing qobject properties at runtime?
<orbifx> At which stage does Lwt actually spawn a thread?
badon has quit [Disconnected by services]
badon_ has joined #ocaml
dsheets has joined #ocaml
badon_ is now known as badon
<toolslive> lwt doesn't spawn threads.
<toolslive> if you don't do a preemptive detach, all fibers basically run on the same thread.
<mrvn> orbifx: qobject properties like QLabel::setText()?
<icicled> thanks for your help mfp!
<mfp> np
jeffmo has quit [Quit: jeffmo]
MercurialAlchemi has joined #ocaml
<orbifx> mrvn: any properties, specially ones for setting up widgets.
<icicled> in the non-lwt thread could I simply do: Lwt_preemptive.run_in_main( fun () -> pusher (Some data) ) |> ignore
<icicled> that shouldn't wake up all the sleeping threads
<mrvn> orbifx: every function of each class needs a binding. I'm thinking of having a preprocessor that generates all the trivial ones from function signatures. Maybe even straight from an mli file.
<icicled> I see that Lwt_preemptive.run_in_main does exactly what you showed in your example
<icicled> sweet =]
mehdi_ has quit [Ping timeout: 252 seconds]
mehdi___ has joined #ocaml
durm has quit [Remote host closed the connection]
<toolslive> is there an opam-repository admin here that can press the button for pr's #5592 and #5593 ?
<icicled> toolslive: thanks for getting that out there quickly!
<mrvn> orbifx: I haven't gotten verry far yet and I'm experimenting. I have a 'a Proxy.t object in C that is a custom block with finalizer that holds the QT object and then a ocaml class that holds the proxy and provides all (eventually) the methods the QT class has.
<icicled> I'm assuming you're mmotl
<toolslive> ??
<icicled> whoops sorry toolslive
<icicled> mistaken identify
<mrvn> orbifx: The idea is to have the same class hirachy in ocaml as in qt.
<mrvn> anyway, not gotten verry far yet
dexterph has quit [Quit: WeeChat 1.3]
Simn has quit [Read error: Connection reset by peer]
jeffmo has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
jeffmo_ has joined #ocaml
jeffmo has quit [Ping timeout: 264 seconds]
jeffmo_ is now known as jeffmo
<orbifx> toolslive: thanks for the answer. Are undetached threads supposed to call `yield`?
<toolslive> undetached threads? you can bind something that is of type 'a Lwt.t to a function that's waiting for something of type 'a via the >>= operator.
<toolslive> let read () = ............... Lwt.return bytes in let write bytes = ............ Lwt.return () in let copy = read () >>= write ...
seangrove has joined #ocaml
<toolslive> so you chain your fibers (functions that return something of 'a Lwt.t) via >>= and you hand your chain to Lwt_main.run
<sspi> Drup: effects + native works now thanks :D
<Drup> sspi: You should mention in on the thread
<Drup> it*
<seangrove> So I have a a file, `parser.mly` that references Liquid.value, and a a file called liquid.ml what has `type value = ...`, and I run _build/sanitize.sh; ocamlbuild -use-menhir -tag thread -use-ocamlfind -quiet -pkg core test.native && ./test.native example.json, but get the error: `Error: Unbound type constructor Liquid.value`
<Drup> seangrove: (13:07:38) Drup: For seangrove when he comes back : https://github.com/dsheets/blueprint
<seangrove> Drup: Heh, yup, familiar with it, but want to build my own right now
<Drup> That's very NIH of you :p
<seangrove> Yup! But also very "I'm new to OCaml and want to build small things so I can learn"
<Drup> Please pastebin the .mly
slash^ has joined #ocaml
<Drup> that seems reasonable
<Drup> can you show the rest ?
<seangrove> Yeah, I'm just working off of the RWO example, I'll add to the gist, one moment
<orbifx> toolslive: how does Lwt switch threads then?
<orbifx> At which point does it switch?
<toolslive> >>= means "if the left hand side takes time, go and do something else, and if the result is ready, come back and take the result and give it to the right hand side"
<seangrove> Drup: Nevermind, found the problem - I never *saved8 the liquid.ml file :0
<sspi> Drup: which thread?
<seangrove> Ah, no, not the problem, arr
<Drup> sspi: github ticket
dexterph has joined #ocaml
<seangrove> Drup: https://gist.github.com/sgrove/449531199243af053b18 (shell at the bottom is probably the most interesting there)
dexterph has quit [Remote host closed the connection]
<seangrove> Bah, nevermind, something keeps deleting the liquid.ml file - so it's there one build and not the next, heh
<orbifx> toolslive: so if it can go away, it either sleep the left task or fork?
<seangrove> Sorry for the scatterbrained posts :p
<toolslive> typically you have other things that are in progress at the same time. It's not parallel it's concurrent.
nkhodyunya has joined #ocaml
<Drup> seangrove: that's weird, nothing should delete anything outside of "_build"
jgjl has quit [Quit: Textual IRC Client: www.textualapp.com]
<orbifx> toolslive: so does it pause the task on the left or fork? I'm trying to understand because I don't want to embed a lwt incompatible infinite loop which is stopped or never switched.
<seangrove> I often see (Buffer.create 17) - why 17?
<mrvn> because 16 is never enough and 18 way too much?
* seangrove goes to meditate on the perfect nature of 17
<Drup> seangrove: It's a tradition, but I have no idea whatsoever where it started
<toolslive> suppose you're calling a read to fetch a string, but the data's not there. you're waiting. The scheduler will set the thread in a wait state and pick up somehting else to do. At some point in the future, the data has arrived, so the scheduler puts the thread in active state and hands the thing waiting the result data.
<mrvn> 17 seems odd though. 15 would keep the allocation at 24 byte, 17 makes it 32 bytes and uses only 17 out of 23 bytes.
<toolslive> the thing that's waiting is what's on the right hand side of the >>= operator
<toolslive> so the >>= determines the points where you can be suspended or resumed
<Drup> seangrove: git grep "create 17" on the compiler reveals numerous examples.
<mrvn> toolslive: it always suspends, it just sometimes resumes right back :)
<toolslive> sometimes you don't need to wait ;)
<toolslive> the scheduler changed over time iirc. it used to try to go as far as possible, but now it's more round robin
<mrvn> continuing in the same thread usualy has better cache locality
<orbifx> toolslive: i get the example with read because its probably using non blocking wrappers. But if I have a 'while true do increment' how does it relinquish control back to scheduler?
dexterph has joined #ocaml
<Drup> If the result is already there, bind doesn't yield
nkhodyunya has quit [Quit: Leaving.]
<mrvn> orbifx: it doesn't. in that case ocaml never ever switched threads at all, ever.
<mrvn> orbifx: ocaml and lwr multithreading is cooperatively. In case of ocaml hidden in allocations. in lwt in >>=
<Drup> (which, if I remember correctly, is the main difference with Async)
octachron has quit [Quit: Leaving]
jeffmo has quit [Quit: jeffmo]
<orbifx> mrvn: that's what I thought. So my options are either lwt_preemptive.detach or raw system forking?
mehdi___ has quit [Remote host closed the connection]
kansi has joined #ocaml
<mrvn> orbifx: ocaml doesn't to parallel multitasking so you have to fork somewhere for that.
<mrvn> orbifx: but why would you do 'while true do increment'?
<mrvn> orbifx: it's easy enough to add a >>= in there to make it go away.
mehdi_ has joined #ocaml
<kansi> hi, how can i fix a dependency of my project so that I can modify it and recompile my project with this modified version ?
dhil has joined #ocaml
<Drup> get the source, fix, opam pin
<toolslive> actually most of the time multiple threads are rather worthless in ocaml because of the runtime lock. Anyway, if you understand how you can use select to write a single threaded server in C (or python or ....) you can understand how lwt works.
<toolslive> it's just a more convenient way of putting all of your IO into 1 single select call
hcarty has quit [Ping timeout: 252 seconds]
<kansi> Drup: would opam source <dep> --pin work ?
<Drup> Yes
<kansi> and will the dep get compiled automatically
<Drup> Yes
<kansi> ok thx
<orbifx> mrvn: i got two event loops, one is SDL and the other is Qml. Both are the ocaml wrappers.
<Drup> (you need to opam reinstall after changes, of course)
<mrvn> orbifx: that's both C code so it should release the runtime lock and alow another thread to run ocaml code.
<orbifx> toolslive: I've used select. But I don't think it will work with the event loops.
<toolslive> select IS the event loop
<mrvn> orbifx: could work with qml, not with SDL. SDL sucks and does busy waits all over the place.
mstevens has quit [Quit: leaving]
<orbifx> mrvn I noticed. So I will have to fork? Not even detach?
<mrvn> orbifx: no, just release the runtime lock
<mrvn> then you can just use normal threads
<orbifx> toolslive: lwt's event loop. But like we are discussing with mrvn, code has to collaborate somehow.
<orbifx> mrvn: how do I release the runtime lock? Any examples?
malc_ has joined #ocaml
<toolslive> typically you have a producer consumer setup
<mrvn> orbifx: the chapter about interfacing with C code in the manual
<toolslive> you only can do this for non-ocaml code
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<toolslive> ctypes has a flag for it.
kansi has quit [Ping timeout: 256 seconds]
Guest38 has joined #ocaml
<orbifx> mrvn, toolslive: I'm using the existing wrappers. I don't want ro write my own.
Simn has joined #ocaml
<mrvn> orbifx: if they don't releast the lock then you have to patch them
yawnt_ has quit [Ping timeout: 240 seconds]
yawnt has quit [Ping timeout: 260 seconds]
<orbifx> mrvn: what if I fork though?
<mrvn> then you have 2 programs running
<toolslive> here's a poor man's parmap thingy to give you a taste of how you can leverage fork: https://gist.github.com/toolslive/5236126
<toolslive> it's tedious.
<orbifx> Bookmarked,thanks
<orbifx> Thanks mrvn, toolslive. Will have to try these another day.
<seangrove> I'm trying to lex/parse (using menhir) something like `{{person.address.street}}`, struggling a bit. I can get {{person}} to parse just fine, but adding optional property accessors (and figuring out a backing datastructure with uniform key types but varying value types) is puzzling me
<aantron> puzzling how?
<seangrove> I realize that's super vague, hope there's enough in there to perhaps point at some documentation + keywords to search for
<mrvn> seangrove: you can't. you either need non-uniform keys or uniform values.
<Drup> you read the menhir manual ?
<mrvn> seangrove: use a variant type to make the values uniform
<seangrove> Drup: Going through it, but it's a bit daunting
<Drup> Not used to parser generators ? :)
dsheets has quit [Remote host closed the connection]
<seangrove> Drup: First time!
<Drup> Right
<seangrove> Hence why I'm doing it to learn :0
mehdi_ has quit [Ping timeout: 260 seconds]
<seangrove> aantron: Say I have this in my parser.ml: `value: | LEFT_DBRACE; id = ID; RIGHT_DBRACE { `Id id }` - that parses `{{person}}` properly, but I optionally need to construct a path for property lookup
sepp2k has quit [Quit: Leaving.]
yawnt has joined #ocaml
mehdi_ has joined #ocaml
yawnt_ has joined #ocaml
<seangrove> I'll keep going through the manual, this is probably very basic stuff, just need to find the right section
accname has quit [Ping timeout: 252 seconds]
<Drup> I would create another rule, id, that parses either an "id DOT ID" or an "ID"
<aantron> seangrove, sounds like you just need to modify your grammar, as Drup is suggesting
<seangrove> Drup: Ah cool, that (and flatten, last) intuitively make sense
kushal has quit [Quit: Leaving]
<Drup> (Lapply is specific to ocaml, you don't need it)
<seangrove> Drup: How does one parse either "id DOT ID" OR "ID"? (and is the capitalization significant in your example?)
<Drup> yes the capitalisation is significant
<seangrove> `(id DOT ID)? id` perhaps?
<Drup> uppercase is for tokens, lowercase is for rules
<seangrove> Ah, ok
<Drup> as for how to parse it, it's the exact same rule as parsing a list
<Drup> there is an exemple in menhir
MercurialAlchemi has joined #ocaml
<Drup> (You can even use menhir's list rule.
<Drup> well, separated list
th5 has quit [Ping timeout: 260 seconds]
<seangrove> Drup: Do you have a link? Downloading menhir and looking through demos/, I don't see anything reference a list
<seangrove> Hrm, think time is up for today actually, will set it aside until later. Thanks for the tips as always!
<Drup> manual, page 15, Figure 3
<Drup> and, also, in src/standard.mly
<seangrove> Ah, the built-in functions, got it
dsheets has joined #ocaml
f[x] has joined #ocaml
orbifx has quit [Ping timeout: 240 seconds]
seangrove has quit [Read error: No route to host]
seangrov` has joined #ocaml
malc_ has quit [Quit: leaving]
Kakadu has joined #ocaml
jeffmo has joined #ocaml
AlexRussia_ has quit [Quit: WeeChat 1.4-dev]
dsheets has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 240 seconds]
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
ggole has quit []
Haudegen has quit [Ping timeout: 276 seconds]
accname has joined #ocaml
aantron has quit [Remote host closed the connection]
larhat has joined #ocaml
darkf has joined #ocaml
aantron has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
Haudegen has joined #ocaml
AlexRussia has joined #ocaml
<Drup> :)
<icicled> I currently have a module in which there are 3 functions (a, b, c) and the "entry point" is "a" which calls b & c with some of the same parameters passed to it
<icicled> how can I organize this better? e.g. it doesn't make sense to pass parameters around to me
<icicled> I could put it in an object or is there a better way?
BitPuffin has quit [Ping timeout: 240 seconds]
nkhodyunya has joined #ocaml
<Drup> what's the problem with passing parameters ?
<icicled> seems repetitive to me
nkhodyunya has quit [Client Quit]
_berke_ has joined #ocaml
ril has joined #ocaml
<icicled> if this is normal please tell me - the majority of my past experience is in java/python where I used classes for organization
<icicled> usually never for inheritance
<aantron> icicled: you mean you stored the parameters as state in the class, and referenced that state in called functions?
<icicled> yes
<aantron> in the instances*
<aantron> ok, yeah its normal not to do that in ocaml, and to pass parameters around
<aantron> arguments* dangit
<icicled> something like: x = Foo(bar, baz); x.a(); x.b();
<aantron> well that looks like a pair
<icicled> Foo is a class (prototype code)
<Drup> icicled: without nothing more about the code, it seems normal to me
<icicled> ok thanks - that's what I needed to know
<sspi> icicled: gist of the problem?
<Drup> sspi: the summary seems to be "icicled is resisting his tendency to write python code in OCaml" :3
<icicled> the last function is the one that is called in another module
<icicled> I'm passing "pusher" around - just wondering if that was normal
<Drup> it is, the global reference however, less so
<toolslive> the haskell way is to create a monad to hold the context
<Drup> toolslive: not for something that simple
<toolslive> they sure are monad crazy :)
accname has quit [Ping timeout: 240 seconds]
<icicled> yes, I need to do soemthing about that ref up top
<icicled> guess I can keep it a ref but put it inside listen_forever
<Drup> Why do you use select instead of just Lwt_preemptive.detach (fun () -> conn#consume_input) ?
julien_t has quit [Ping timeout: 252 seconds]
<icicled> I'll try your recommendation
<Drup> Well, he doesn't use lwt, so he has to use select directly
<toolslive> don't mix lwt with select....
<icicled> why not?
<icicled> Drup: turns out I can't remove it else it spins the CPU
<icicled> consume_input is an async postgres call after which you can use conn#notifies to check for data
<icicled> so select is needed to avoid spinning
<Drup> I'm not sure I understand why it would block, but I don't know much about this binding
<icicled> it doesn't block which is why it spins
BitPuffin has joined #ocaml
<Drup> Let me guess, it's a C binding ?
<icicled> yes
<edwin> why not pgocaml? there's an example of using it with lwt https://github.com/mk270/postgres-lwt-example/blob/master/main.ml
<Drup> yeah, figured
<Drup> edwin: what he wants doesn't seem to be implemented in pgocaml
<icicled> edwin: I need the listen/notify feature that postgresql offers
_andre has quit [Quit: leaving]
aantron has quit [Remote host closed the connection]
hcarty has joined #ocaml
toolslive has quit [Quit: Leaving]
<Drup> icicled: there is a blocking mode
<icicled> right & its the default but it is for queries
<icicled> notifications can arrive asynchronously in postgresql
ak0s has joined #ocaml
<icicled> if I didn't use conn#consume_input then I would have to run some query every n seconds and then process the notifications
kamog has joined #ocaml
<icicled> toolslive mentioned that mixing select & lwt is frowned upon - what's the reason behind this?
idegen has joined #ocaml
idegen has left #ocaml [#ocaml]
BitPuffin has quit [Read error: Connection reset by peer]
Haudegen has quit [Ping timeout: 240 seconds]
Simn has quit [Quit: Leaving]
abbiya has joined #ocaml
Haudegen has joined #ocaml
theblatt1 has joined #ocaml
lobo has joined #ocaml
theblatte has quit [Ping timeout: 250 seconds]
ollehar has joined #ocaml
theblatt1 has quit [Ping timeout: 276 seconds]
theblatte has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
StatelessCat has joined #ocaml
<StatelessCat> hey
<StatelessCat> I have a question, is Ocaml a "Dromadaire" in french, or a "Chameau" ?
<StatelessCat> how many boss in the animal, one or two ?
<StatelessCat> because Real World Ocaml has a cover with two, Ocaml from the very begunning -> one, and More Ocaml they just have a picture of the head of an ???
<Drup> This is the official logo
accname has joined #ocaml
<StatelessCat> sorry for the question ,guys :)
<smondet> the family of both species (one or two humps) is still called Camelid https://en.wikipedia.org/wiki/Camelid
abbiya has quit [Ping timeout: 240 seconds]
<smondet> and the genus Camel(us) https://en.wikipedia.org/wiki/Camel
<StatelessCat> :)
slash^ has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
aantron has joined #ocaml
seangrov` has quit [Ping timeout: 250 seconds]
<pierpa> statelesscat: OFTVB it has only one because it's for beginners
<icicled> If I create a ref for an atomic type (e.g. bool ref) is the ref also atomic or would I need to use a synchronization primitive if I want to share it among threads?
<StatelessCat> pierpa: :)
crass has quit [Remote host closed the connection]
<hcarty> icicled: "my_bool_ref := false" should be safe without a wrapper
<hcarty> If the expression on the right hand side of := allocates, though, then it's not
<icicled> awesome, that's really good to know - thanks hcarty
dhil has joined #ocaml
raphaelss has joined #ocaml
dexterph has quit [Remote host closed the connection]
dexterph has joined #ocaml
silver has quit [Quit: rakede]
ollehar has quit [Quit: ollehar]
f[x] has quit [Ping timeout: 240 seconds]
<hcarty> Updating a ref in general would be atomic, regardless of its content. It's the creation of the new value that goes into the ref which may not be.
<icicled> makes sense
lmaury has quit [Quit: Leaving]
<icicled> btw, I don't know if my unix foo is wrong but according to the following command only 63 opam packages have docs specified: find ./ -name opam -print | xargs egrep -ho 'doc:\s+"(.+)"'| sort -u | wc -l
<icicled> done in opam-repository/packages
ak0s has quit [Ping timeout: 240 seconds]
seangrov` has joined #ocaml
Algebr has joined #ocaml
Algebr is now known as Guest80000
MercurialAlchemi has quit [Ping timeout: 252 seconds]
Guest80000 is now known as Algebr2
seangrov` has quit [Ping timeout: 272 seconds]
BitPuffin|osx has joined #ocaml
raphaelss has quit [Ping timeout: 256 seconds]
Haudegen has quit [Ping timeout: 264 seconds]
yawnt_ has quit [Ping timeout: 250 seconds]
yawnt has quit [Ping timeout: 248 seconds]
f[x] has joined #ocaml
hcarty has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
julien_t has joined #ocaml
<edwin> interesting to see that little init that was on ocaml subreddit the other day near the top of HN now
m_x_v has quit [Ping timeout: 276 seconds]
<Drup> HN tastes are impenetrable.
ril has joined #ocaml
kamog has quit [Remote host closed the connection]
seangrov` has joined #ocaml
tane has quit [Quit: Verlassend]
accname has quit [Ping timeout: 240 seconds]
jeffmo has quit [Quit: jeffmo]
Guest38 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
_berke_ has quit [Remote host closed the connection]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ril has joined #ocaml
JacobEdelman_ has quit [Quit: Connection closed for inactivity]
ril has quit [Client Quit]
Kakadu has quit [Remote host closed the connection]
ril has joined #ocaml