<seangrove>
Hey all, how can I list the child process ids given a parent process id?
Algebr``` has quit [Ping timeout: 250 seconds]
Algebr``` has joined #ocaml
fooey has joined #ocaml
jeffmo has quit [Quit: jeffmo]
hx1 has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
Algebr``` has quit [Ping timeout: 250 seconds]
bensu_ has quit [Remote host closed the connection]
bensu_ has joined #ocaml
AllanDaemon has quit [Quit: Leaving]
AllanDaemon has joined #ocaml
<def`>
seangrove: the way I know is by reading the procfs
<def`>
this is not portable, each OS implements it in its own way
two_wheels has joined #ocaml
tmtwd has joined #ocaml
bensu_ has quit [Remote host closed the connection]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
<gasche>
Algebr, aantron: inside the OCaml compiler there is no clean representation for what the typed AST should be
bensu_ has joined #ocaml
<gasche>
there is a "typed ast", but it is the format that is used for type inference; it can express a continuum for the not-typed-et to the fully-typed, is complex and full of subtle invariant and implementation details, and it would be a horrible representation to express transformations on
<gasche>
(the one typed metaprogramming feature we have, {scan,printf}f formats, give up on producing a typed ast directly and produce a parsetree and re-check it afterwards)
bensu_ has quit [Remote host closed the connection]
<gasche>
but there is hope, namely the ongoing work of Pierrick Couderc, writing a clean fully-typed representation and a checker for it; see the article currently trending on reddit/r/ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
bensu_ has joined #ocaml
hx1 has quit [Ping timeout: 246 seconds]
bensu_ has quit [Remote host closed the connection]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
fooey has quit [Quit: Leaving]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
bensu has joined #ocaml
fluter has quit [Ping timeout: 264 seconds]
SomeDamnBody has quit [Remote host closed the connection]
bensu has quit [Remote host closed the connection]
bensu has joined #ocaml
yunxing__ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
fluter has joined #ocaml
yunxing_ has quit [Ping timeout: 250 seconds]
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #ocaml
bensu has quit [Remote host closed the connection]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
bensu has joined #ocaml
bensu has quit [Remote host closed the connection]
bensu has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
|2321 has quit [Quit: Connection closed for inactivity]
<aantron>
gasche: thanks for the info
yunxing_ has joined #ocaml
yunxing_ has quit [Client Quit]
bensu has quit [Remote host closed the connection]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
bensu_ has joined #ocaml
bensu_ has quit [Remote host closed the connection]
bensu_ has joined #ocaml
jeffmo has joined #ocaml
bensu_ has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 244 seconds]
hx1 has joined #ocaml
Fernandos has joined #ocaml
<Fernandos>
Hi
<Fernandos>
I just tried installing spoc, because I want to use opencl in OCaml/Reason, however the build fails and I'm clueless.. Would you mind helping?
<Fernandos>
I trust you on that, but I would've started with OCaml instead of Haskell if I found OCaml's language&synthax more attractive and easier to use
<Fernandos>
Other than that I think that OCaml is already doing what Haskell claims, but ultimately can't, to get out of academia and into the "real world".. where most people won't get Monads, or write clean code all of the time.
tmtwd has quit [Ping timeout: 250 seconds]
<Fernandos>
chenglou: is there any IPC or FFI, or a hack like system() to pass data in/out of a Reason program to one in another language?
<chenglou>
Fernandos: it's the same system ocaml would use since reason is just a syntax transform
<chenglou>
Whatever code works now, pipe it through refmt to get the reason version
<chenglou>
(Or did you try that and encountered something else?)
<Fernandos>
Not yet, I'm still at the very beginning with Ocaml, just wrote a simple perceptron impl. but would rather use Reason solely, if possible
<Drup>
Fernandos: FFI, with ctypes, there is a chapter about it in RWO.
MercurialAlchemi has joined #ocaml
<Fernandos>
I think an ecosystem like Scala's java library compatibliity, but without the java-esque boilerplate would be nice. The problem would be that each new OCaml library would require a new Reason interface or wrapper unless there isn't a generic way of doing accessing OCaml using an architecture-pattern
<Fernandos>
will look into that
yunxing_ has joined #ocaml
jonasen has joined #ocaml
<chenglou>
Fernandos: brt, on mobile
<Fernandos>
np, gotta go the the AI class soon anyway :)
<Drup>
Fernandos: you don't need a compatibility layer, it's already compatible
yunxing__ has joined #ocaml
<Fernandos>
Oh I mean let's for example take an OCaml array library, it has functions, types etc and accessing these in Reason is I guess easily possible too, but I thought that you would have to write idiomatic OCaml code in Reason if you use that Ocaml library (the price of being compatible). I hope I'm wrong though :)
pierpa has quit [Ping timeout: 240 seconds]
<yunxing>
Fernandos: oh I think reason and ocaml has the same idioms
manud has quit [Quit: manud]
<yunxing>
Idioms are for semantics layer, Reason currently has only changed syntax layer
yunxing_ has quit [Ping timeout: 250 seconds]
<Fernandos>
yep I know, if that's right it's really clever solution
<chenglou>
The syntax is mostly 1-1 mapping
sdothum has quit [Ping timeout: 258 seconds]
<Fernandos>
that sounds almost like an API isomorphism
<Fernandos>
cool
<chenglou>
Using reason is basically using ocaml but passing a few new flags so that it uses our parser instead of the build in default one
<chenglou>
We don't even have any theoretical compile time overhead because of this (you'd need to parse anyway)
<yunxing>
chenglou: parsing maybe a tiny bit slower because of the algorithm Menhir used.
<chenglou>
Aaah
<Fernandos>
hmm, then I really hope that you guys take over OCaml in the next version :P
sdothum has joined #ocaml
sdothum has quit [Client Quit]
<Fernandos>
Personally my most anticipated language feature in any language is Non-linear pattern-matching. Here's a language doing that https://www.egison.org/
<chenglou>
Aaaaah that. Is it the e.g. | Foo n n => ...
<Fernandos>
That's actually what makes writing highly complex code streightforward (as long as symbols aren't overused, imho)
<chenglou>
Fernandos: do you have a tldr of non linear matching? I might have understood it wrong
<Fernandos>
In my words: probabilistic, other algorithm, or even neural-net driven pattern-matching
<Fernandos>
Against Non-Free Data Types
<Drup>
chenglou: it's just the fact that you can have a variable multiple time in a pattern, like you said
<Fernandos>
it's not hard to do, but hard to do right
fluter has quit [Ping timeout: 260 seconds]
bensu_ has quit [Remote host closed the connection]
fluter has joined #ocaml
<Fernandos>
Pattern Matchers are the sweetest form of cheating, but combined recursively like we do daily in natural language, it becomes an incredibly powerful composable and reusable abstraction that actually results in less code weight (and optimally also in less machine instructions due to the concise nature=
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
manud has joined #ocaml
<Fernandos>
wow that hello world example is really a small binary
madroach_ has joined #ocaml
madroach has quit [Read error: Connection reset by peer]
<chenglou>
Fernandos: ocaml also has great interop with js through js_of_ocaml and more recently, bucklescript
<chenglou>
like how exactly would you be using that variable in the matcher? I think I'm not being imaginative enough
manud has joined #ocaml
<Drup>
let rec dedup = function [] -> [] | h :: h :: t -> h :: dedup t
<Drup>
(that's a crapy example, but you get the diea)
<Drup>
and no, that doesn't work, the real ocaml version is like that:
<Drup>
let rec dedup = function [] -> [] | h :: h' :: t when h = h' -> h :: dedup t
<chenglou>
right, and now you'd have to compare the `h`s
<chenglou>
ok yeah here it's `=`
<chenglou>
but can I define how the comparison is done? Like, 1 = 1. or something
<chenglou>
`1 = 1.0` to be clear
<Drup>
In which version ?
<chenglou>
the non-linear pattern matching version
<Drup>
that's one problem with that feature.
<chenglou>
because you'd essentially have to allow some random comparison function to achieve the same thing as you did with `when` right
<chenglou>
going through the paper right now. I remember Egison from some HN threads
manud has quit [Quit: manud]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 244 seconds]
jonasen has joined #ocaml
AlexDenisov has joined #ocaml
ygrek_ has joined #ocaml
<chenglou>
Drup: "We can define the equality for each data type in the matcher"
<chenglou>
"Note that we can write an any expression in a value-pattern"
<chenglou>
aaaah neat
Mercuria1Alchemi has joined #ocaml
bensu_ has joined #ocaml
atbagautdinov has joined #ocaml
bensu_ has quit [Ping timeout: 252 seconds]
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
A1977494 has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 240 seconds]
nicholasf has joined #ocaml
gasche has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
meiji11 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Fernandos has quit [Quit: WeeChat 1.5]
FreeBirdLjj has joined #ocaml
adi___ has quit [Ping timeout: 272 seconds]
AltGr has joined #ocaml
AlexDenisov has joined #ocaml
nicholasf has quit [Ping timeout: 276 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
kushal has quit [Quit: Leaving]
Reventlo1 is now known as Reventlov
Reventlov has quit [Changing host]
Reventlov has joined #ocaml
yunxing__ has quit [Ping timeout: 250 seconds]
manud has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
jonasen has quit [Ping timeout: 252 seconds]
manud has quit [Quit: manud]
manud has joined #ocaml
hallow_me has joined #ocaml
hallow_me has quit [Client Quit]
hx1 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
travula has joined #ocaml
hx1 has quit [Ping timeout: 244 seconds]
larhat has joined #ocaml
<travula>
join #sqlalchemy
dexterph has joined #ocaml
travula has quit [Quit: Leaving]
travula has joined #ocaml
jonasen has joined #ocaml
adi___ has joined #ocaml
jwatzman|work has joined #ocaml
meiji11 has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
dave24 has joined #ocaml
tane has joined #ocaml
tane has quit [Client Quit]
tane has joined #ocaml
silver has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
dhil has joined #ocaml
bensu has joined #ocaml
ygrek_ has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
nicholasf has joined #ocaml
bensu has quit [Ping timeout: 252 seconds]
manud has quit [Quit: manud]
<Leonidas>
why would I?
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
AllanDaemon has quit [Ping timeout: 252 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
fluter has quit [Ping timeout: 264 seconds]
FreeBirdLjj has joined #ocaml
sfri has quit [Remote host closed the connection]
sfri has joined #ocaml
fluter has joined #ocaml
AllanDaemon has joined #ocaml
nicholasf has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
sdothum has joined #ocaml
FreeBirdLjj has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
darkf has quit [Ping timeout: 250 seconds]
kandu_ has quit [Ping timeout: 258 seconds]
kandu has joined #ocaml
kandu is now known as Guest80697
fluter has quit [Quit: WeeChat 1.2]
fluter has joined #ocaml
Ravana has quit [Excess Flood]
Ravana has joined #ocaml
clog has quit [Ping timeout: 276 seconds]
Kakadu has joined #ocaml
octachron has joined #ocaml
d0nn1e has quit [Ping timeout: 264 seconds]
hx1 has joined #ocaml
d0nn1e has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Ravana has quit [Ping timeout: 260 seconds]
hx1 has quit [Ping timeout: 260 seconds]
Ravana has joined #ocaml
ygrek_ has joined #ocaml
<tormen_>
Hi. I suppose using (1.) out_file_descr = Unix.openfile ... ;; (2.) out_channel = Unix.out_channel_of_descr out_file_descr ;; (3.) close_out_noerr out_channel ;; I will NOT need to call Unix.close out_file_descr afterwards, because it is already taken care of by close_out_noerr ?
<apache2>
kind of annoying that "output" is reserved
<Drup>
hum, it's not.
silver_ has joined #ocaml
<tormen_>
I am a bit confused because in the Pervasives doc it just says "Close the given channel," ... but here I have an out_channel AND a UNIX.file_descriptor ...
<apache2>
I must have been doing something wrong, then. I first tried to call my variable "output", then "output_value". turns out both of them are pervasives functions
<tormen_>
... as Pervasives does not know anything about Unix... how can it close the Unix file-descriptor (obtained by Unix.openfile) ?
<apache2>
because the out_channel may internally be bound to that unix fileno ?
silver has quit [Ping timeout: 260 seconds]
rossberg_ has joined #ocaml
rossberg has quit [Ping timeout: 264 seconds]
jonasen has joined #ocaml
agarwal1975 has quit [Quit: agarwal1975]
silver_ is now known as silver
A1977494 has quit [Remote host closed the connection]
ewanas has joined #ocaml
kushal has joined #ocaml
<tormen_>
apache2: and then Pervasives takes care of closing the unix file descriptor ?
<apache2>
tormen_: how do you create the out_channel?
<apache2>
tormen_: I just verified that, yes.
AlexDenisov has joined #ocaml
<apache2>
(you can see the open file descriptors for a process in Linux with `ls -l /proc/{the pid of the process}/fd/` if you have /proc mounted
<tormen_>
apache2: Looking in /proc: Ah yes of course! Nice idea :)) ... about how I open them see my post just a view lines up: (1.) out_file_descr = Unix.openfile ... ;; (2.) out_channel = Unix.out_channel_of_descr out_file_descr ;; (3.) close_out_noerr out_channel ;;
sepp2k has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jonasen has joined #ocaml
mettekou has joined #ocaml
cheater has joined #ocaml
<cheater>
hi
<cheater>
in ocaml, what are functors? are they related to ocaml modules?
<companion_cube>
yes, a functor is (roughly) a function from modules to modules
<companion_cube>
takes a module in, outputs a module (that depends on the input)
zaquest has quit [Ping timeout: 260 seconds]
<cheater>
oh
<cheater>
i remember now
<cheater>
so basically it's like a parametric module?
<companion_cube>
yes
<cheater>
like this stuff in mirage where you can have a networking module and that can take different arguments depending if you run on xen or linux
<companion_cube>
yes
<cheater>
makes sense, thanks
<companion_cube>
or a data structure parametrized on some type
<cheater>
what's the best way to get ocaml on ubuntu btw?
<companion_cube>
e.g. Set.Make(X) is a set of X.t
<cheater>
a recent version
<cheater>
i've got ubuntu 14.04 which probably won't have the latest package
<companion_cube>
you can use opam
<cheater>
i've got 0 ocaml on my pc right now
<companion_cube>
install the default ocaml, and use it to install opam (it sholud be all explained on opam.ocaml.org)
two_wheels has joined #ocaml
<cheater>
oh nice there's a ppa
<cheater>
i'll just use that
shinnya has joined #ocaml
hx1 has joined #ocaml
<cheater>
when doing "opam config env" should i do it under sudo or not?
<cheater>
obviously this requires some external dependencies
<theblatte>
opam doesn't have that yet, you can use local switches in opam to have something a bit like this, but for now the best way to have a sandboxed install is to use docker
<companion_cube>
in any case, opam doesn't write in system dirs, only in ~/.opam
<cheater>
ah ok so worst case scenario i just launch missiles on ~/.opam
<companion_cube>
yep
<theblatte>
except when you need system dependencies to install some opam package
<Khady>
but the separation between switches works well, so you shouldn't have to launch missiles on .opam
<cheater>
ok, so
<cheater>
i cloned that repo and tried doing: $ ocaml hello_lwt.ml
<cheater>
it complained about: Error: Unbound module Lwt
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<cheater>
so obviously some build system is in order, i just don't know how this works really
<cheater>
or some package system or something like that
<travula>
let ratio x y = Float.of_int x /. Float.of_int y
<Drup>
cheater: you'll have to wait a bit, a new version of cohttp was just released and webmachine is not compatible with it (and it was not flaged in the opam repo ... ಠ_ಠ)
<Drup>
I'm sure it will be fixed shortly
<travula>
when execute this, I get this error - "Error: Unbound module Float"
<Drup>
travula: you are reading RWO ?
<travula>
cheater, thanks
<travula>
Drup, yes
<chelfi>
travula: did you follow the installation instructions for the Core library ?
<cheater>
aha, it's "opam pin add"
<cheater>
Drup: aha, well, i'm trying to get it working *now* :)
<cheater>
for some reason i was doing "ocaml pin add" - silly mistake
<travula>
Drup, could you please give me the link for core installation?
<Khady>
you can also opam install cohttp.0.20.2 cheater
<companion_cube>
it's pretty annoying that ocamloscope is so narrow
<hcarty>
dave24: merlin can be helpful with this, at least for identifying the type of an entity
<dave24>
thanks
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<hcarty>
companion_cube: According to the README it's tied rather closely to 4.01.0 which may also make adding more libraries difficult
<hcarty>
One day codoc (or whatever it's latest incarnation is) will save us all
<dave24>
there are a lot of results for >>=, the example here: https://github.com/mirage/ocaml-cohttp seems to imply that the reader knows what >>= is. But I have no clue.
<companion_cube>
oh, is codoc supposed to do that as well?
<companion_cube>
I'd bet on merlin, personnally
bensu has joined #ocaml
regnat[m] has quit [Ping timeout: 264 seconds]
M-pesterhazy has quit [Ping timeout: 276 seconds]
M-martinklepsch has quit [Ping timeout: 260 seconds]
M-Illandan has quit [Ping timeout: 260 seconds]
M-jimt has quit [Ping timeout: 276 seconds]
bensu has quit [Ping timeout: 252 seconds]
AlexDenisov has joined #ocaml
<hcarty>
dave24: In the case of cohttp it's most likely (always?) the bind operator for the concurrency library being used
Reshi has joined #ocaml
Mercuria1Alchemi has quit [Ping timeout: 272 seconds]
Sorella has joined #ocaml
jonasen has joined #ocaml
<dave24>
hcarty: yeah thanks, i found it
<cheater>
i just assumed it was bind
<cheater>
i am not sure what >|= is though
Kakadu has joined #ocaml
<Kakadu>
.о прс
<Kakadu>
oops
<octachron>
(>|=) might be (f)map (i.e bind x (return . f) )
<cheater>
which is the functor, the left or right parameter?
<cheater>
i.e. is >|= exactly like haskell's <$> or is it flipped?
<Drup>
cheater: flipped
<cheater>
thanks
<Drup>
(same direction as >>=)
<cheater>
mhm
gasche has joined #ocaml
<cheater>
if i'm using webmachines, is there a good way to do long polling?
regnat[m] has joined #ocaml
walter|r has joined #ocaml
<hcarty>
cheater: I haven't used webmachine yet, but from a cohttp perspective I'm not sure anything special is required
<cheater>
OK
<cheater>
is there a search engine like haskell's hoogle?
<cheater>
i would like some place where i can find out what those are: >|=, >>|, etc
<hcarty>
cheater: http://ocamloscope.herokuapp.com/ has a very limited set of libraries that you can search. Otherwise merlin and maybe ocp-browser (part of ocp-index)
<cheater>
not sure where to get docs for the async library, and in specific Rpc.Connection.create
<gasche>
hannes: I forgot to push
<gasche>
thanks
<gasche>
(I rebuilt the world to run the testsuite and swapped mental contexts)
ygrek_ has quit [Ping timeout: 276 seconds]
Jaxan_ is now known as Jaxan
<gasche>
(pushed now)
<companion_cube>
o/ gasche
<gasche>
hi
<companion_cube>
I'm excited by the stdlib contribution guidelines :)
<gasche>
yep
<gasche>
it's cool
<gasche>
I thought of posting a message somewhere to point out that this is not a "long truth unearthed only now" but rather a conscious change of behavior
<gasche>
the document sounds like "we've been open to changes all along"
<companion_cube>
that's a good signal anyway
<gasche>
yep
<companion_cube>
I just need to check what stdlib tests look like
tane has quit [Quit: Leaving]
<gasche>
which is also why I didn't say anything
<rks`_>
confirmed by the first PR made by Alain which pleased everyone
<gasche>
ah
<gasche>
they are none?
<companion_cube>
(obtw, I'm planning to make qtest use ounit more closely, in particular for optional junit output)
<gasche>
Sébastien Hinderer is interested in all things testsuites, so please get in contact with him and Damien if you want to do something on the stdlib's
<gasche>
I do think that it would be very good; in some occasions I have used Batteries' tests to gain trust in code I touched in the stdlib because the testing there is inadequate
<gasche>
hm
pierpa has joined #ocaml
<gasche>
(I mean it: do get in contact!)
<gasche>
rks`_: yeah
<companion_cube>
can you pm me his email?
<companion_cube>
oh well, @ inria.fr
<gasche>
so I'm also worried by how difficult it will actually be to handle those pull requests
<gasche>
(eg. "split" which I think is a minefield)
<companion_cube>
I'm not very optimistic about String, but I want to try and integrate iterators
<rks`_>
:)
<gasche>
I think I'm helping people by not getting involved in these discussions
<gasche>
there is some relief in letting others get their hands dirty with this thorny problem, but also slight anxiety at suffering the consequences down the road
<gasche>
(I think Batteries has shown that it's very hard to make the right call each time)
<companion_cube>
it's always complicated, don't you worry
<gasche>
there is also the fact that
<gasche>
people resent reviewers for bikeshedding on, for example, the function name
<gasche>
but the name *really matters*
<gasche>
(it's a case where the bike shed is the whole point, almost)
<cheater>
is async still maintained or is it some sort of thing that isn't being used any more?
<gasche>
I think we should develop an explicit process for how to handle those PRs, instead of the absence of directives we have now
<gasche>
cheater: it is heavily used
<cheater>
ok. i'm using a slightly older tutorial and apparently some types of some things have changed.
<companion_cube>
gasche: names, and signatures (e.g. labels)
<gasche>
(as you could see by looking at the version history)
<gasche>
yep
<cheater>
i'm not sure how to access the version history gasche - would you mind showing me where it is? it's literally my first few hours with ocaml
<gasche>
for 4.03 we made an agreement at the dev. meeting to accept functions with an "unquestionable" interface: if anyone had a doubt, the function was not getting in
<Drup>
gasche: I think that a good first approach would not really try to add new functions to the stdlib (such as String.split) but add the various common datatypes we need (such as the recent UChar, or, hopefully, iterator datatypes)
<cheater>
i am trying to update this code to the latest async. would someone mind giving me a pointer? i'll describe what refactorings i did so far, but now i'm stuck
<companion_cube>
there's a good reason to have them in the stdlib: they can't be provided from outside
<rks`_>
result and option are obvious, for "iterator datatypes" there are different possible implementations, aren't there?
<gasche>
mrvn: the bytecode compiler/runtime does, not ocamlopt
<rks`_>
or am I misunderstanding what you guys are talking about?
<companion_cube>
rks`_: there should be a discussion about it, yeah
<companion_cube>
but this time involving the stdlib maintainers
<rks`_>
I don't see the point.
<gasche>
I meant to say that this 4.03 policy was really good in helping us make decisions
<companion_cube>
well, how can I iterate on a Map if the stdlib doesn't provide iterators?
<gasche>
(it's of course a bit more conservative than what we should have long-term)
<companion_cube>
(I will try to propose data-structure-specific cursors, though)
<gasche>
maybe I'll send an email about it
<rks`_>
.
<gasche>
hm
<rks`_>
companion_cube: when you guys sent "iterator datatypes" I thought you were talking about you sequence library and such
<rks`_>
or batteries Enum
<gasche>
should I ask these questions on the caml-list thread, or on the github PR against contributing.md?
<Drup>
rks`_: sequence
<rks`_>
I didn't think you meant "Map should provide an iter function"
<Drup>
(or gen)
<rks`_>
gasche: doesn't matter, yotam will comment anyway
<Drup>
Certainly not Enum
<companion_cube>
rks`_: I'm thinking about to_gen/of_gen, for instance
<companion_cube>
right now it's purely impossible to write this
<rks`_>
right
<gasche>
let's go to github
<gasche>
it's more a question for devs/contributors
<gasche>
hm
<companion_cube>
gasche: discussion on the ml sounds ok, if you reply to Damien's announce
<cheater>
i would appreciate any hints on how to get this code to type check
<cheater>
not sure how to make the relevant code into a Deferred
sh0t has joined #ocaml
A1977494 has joined #ocaml
al-damiri has joined #ocaml
sh0t has quit [Ping timeout: 244 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
sh0t has joined #ocaml
<cheater>
ok. i looked inside async_rpc and that showed me what the type of ~on_unknown_rpc is. I got the thing to typecheck by saying: ~on_unknown_rpc:(`Close_connection) but i'm not sure how to make it log like it did before.
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gasche has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
<hcarty>
cheater: This 'with' syntax is from older syntax extensions. The more current/modern way to do this is something along the lines of "type t = { ... } [@@deriving sexp, bin_io, compare]"
<cheater>
ok, i was searching around and couldn't find any reference to this use of "with"
<cheater>
that makes sense
<cheater>
in haskell i'd assume those are typeclasses, what are they called in ocaml?
<hcarty>
The [@...] syntax specifies attributes. If you use an appropriate pre-processor those attributes can specify things like "generate serialization and comparison functions for this type"
<cheater>
hcarty: thanks. so this is generics? is that what this mechanism is called?
<chelfi>
cheater: ocaml does not have a mechanism for implictly passing functions around, like haskell typeclasses
<hcarty>
cheater: Not really. These derived functions are built by looking at the language AST and building appropriate code based on that
<hcarty>
And what chelfi said
<chelfi>
the [@...] syntax is kinda the equivalent of Template Haskell in ocaml land
nicholasf has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
<cheater>
ahhh ok thanks
<cheater>
thank you for this explanation, i'm learning very quickly here :-)
walter|r has quit [Remote host closed the connection]
pyon has quit [Disconnected by services]
pyon has joined #ocaml
<hcarty>
cheater: Welcome to the wonderful world of OCaml :-)
nicholasf has quit [Remote host closed the connection]
<cheater>
hcarty: :))
bensu has joined #ocaml
larhat has quit [Quit: Leaving.]
bensu has quit [Ping timeout: 252 seconds]
dhil has quit [Ping timeout: 272 seconds]
yunxing_ has joined #ocaml
mettekou has quit [Read error: Connection reset by peer]
<cheater>
lol i just typed in some code that i guessed randomly would be in the library, and it was and everything compiled.
bensu has joined #ocaml
malc_ has joined #ocaml
MercurialAlchemi has joined #ocaml
<chelfi>
if you used merlin you would not need to guess :p
<flux>
well where's the fun in that..
sh0t has quit [Ping timeout: 260 seconds]
sh0t has joined #ocaml
<dave24>
I'm getting a type mismatch (is 'string option array array' but expected 'unit') on line 7 of this code: http://codepad.org/4yJWqpq4
<dave24>
why does it think it should be "unit"
<flux>
column?
<hcarty>
dave24: You put ';' in the middle of the line
<flux>
right, Array.append returns the new array, it doesn't modify the old one
<dave24>
oh right, i need to do "loop (array.append....) result"
<dave24>
thanks lads
wiredsister has joined #ocaml
<flux>
btw, I should advice that one should typically prefer lists instead of arrays
<dave24>
flux: hmm but this mysql binding uses arrays
<flux>
you can convert the list into an array at the last step if that's appropriate
<hcarty>
flux: Arrays are used there to match column numbers
<flux>
the Array.append ret [|row|] is going to get slower as the size of ret increases
<flux>
so something like: Some row -> loop (ret::row) result | None -> Array.of_list (List.rev ret) ?
<flux>
oops, (row::ret) of course
<flux>
you can construct the intermediate result in an array if you don't expect to have large results, such as is the case here, though :-)
AltGr has left #ocaml [#ocaml]
<dave24>
oki
<flux>
dave24, this is actually a very common pattern, to construct a list in reverse and then reverse it in the final step
<flux>
or, in your case, you have so little data that you could just forgo the ret argument and do it the 'natural' way: let result = Sql.execute sel [||] in let rec loop () = match Sql.fetch result with | Some row -> row::loop () | None -> [] in Array.of_list @@ loop ()) :) (but risk stack overflow you were avoiding)
<aantron>
companion_cube: hcarty: im going to merge Lwt_result https://github.com/ocsigen/lwt/pull/247 (in a bit). hcarty: i agree about things like the name of fail. i suggest we make follow-on PRs for those to discuss them independently. if that sounds reasonable to you guys, i'll post something to that effect on GH and proceed
<companion_cube>
\o/
ewanas has joined #ocaml
<hcarty>
aantron: Lovely! I'm fine with moving the conversation on naming specifics to a different PR
octachron has quit [Quit: Page closed]
sh0t has quit [Ping timeout: 246 seconds]
<hcarty>
As far as names go, I'm biased toward Rresult as I've been happily using that for a while. I'm glad this is making it in to Lwt
AlexRussia has joined #ocaml
<companion_cube>
I'm glad I won't have to reimplement it yet another time
<companion_cube>
maybe we could have specific infix values, btw? so that we can have both lwt and lwt_result binders in scope
Reshi has quit [Ping timeout: 250 seconds]
atbagautdinov has left #ocaml [#ocaml]
<hcarty>
companion_cube: And Lwt_option and Lwt_option_result and Lwt_result_option and Result_lwt and Option_lwt... I don't think I've needed Result_option_lwt yet though
<companion_cube>
:D
<companion_cube>
we need implicits
<hcarty>
Indeed
wiredsis` has joined #ocaml
<aantron>
impliciiiiiiiiiiits pleeaaaaaase
<aantron>
had a project with many monads
<aantron>
need implicits
rgrinberg has quit [Ping timeout: 244 seconds]
wiredsister has quit [Ping timeout: 260 seconds]
<zozozo>
what's the lateste news about implicits ?
<aantron>
gah, the travis builds havent even started. im going to wait for at least 1 row in each of {4.01, 4.02, 4.03} to complete, just in case, then its merged :) thanks companion_cube, hcarty! :)
yunxing_ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
wiredsis` has quit [Remote host closed the connection]
hbar_ has joined #ocaml
mettekou has joined #ocaml
<chelfi>
zozozo: looks nice, not ready yet ? :)
<zozozo>
any idea as to when it will be stable enough to be considered for inclusion ?
<hcarty>
zozozo: The last answer I saw to that question was, effectively, "Don't ask"
rgrinberg has joined #ocaml
<zozozo>
:/
<zozozo>
well, at least I can dream while waiting, ^^
Kakadu has quit [Quit: Page closed]
wiredsister has joined #ocaml
malc_ has quit [Remote host closed the connection]
AlexDenisov has joined #ocaml
walter|r has joined #ocaml
Algebr` has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
octachron has joined #ocaml
TheLemonMan has joined #ocaml
bensu___ has joined #ocaml
<companion_cube>
aantron: travis on mac OS is the joke, still not finished
<aantron>
yeah, merging now though
<aantron>
havent seen a day like this in travis yet.
rand__ has joined #ocaml
bensu____ has joined #ocaml
pyon has quit [Ping timeout: 264 seconds]
wolfcore has quit [Ping timeout: 264 seconds]
nzyuzin_ has quit [Ping timeout: 264 seconds]
osheeta has quit [Ping timeout: 264 seconds]
metaglog has quit [Ping timeout: 264 seconds]
bensu has quit [Ping timeout: 252 seconds]
osheeta has joined #ocaml
bensu___ has quit [Ping timeout: 264 seconds]
M-pesterhazy has quit [Ping timeout: 264 seconds]
cdidd has quit [Ping timeout: 264 seconds]
jerith has quit [Ping timeout: 264 seconds]
luzie has quit [Ping timeout: 264 seconds]
asm89 has quit [Ping timeout: 264 seconds]
nopf has quit [Ping timeout: 264 seconds]
nzyuzin has joined #ocaml
jerith has joined #ocaml
nopf has joined #ocaml
wolfcore has joined #ocaml
Algebr` has quit [Read error: Connection reset by peer]
Algebr` has joined #ocaml
M-pesterhazy has joined #ocaml
luzie has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
metaglog has joined #ocaml
metaglog has quit [Changing host]
metaglog has joined #ocaml
AllanDaemon has quit [Ping timeout: 244 seconds]
Kakadu has joined #ocaml
cdidd has joined #ocaml
asm89 has joined #ocaml
wiredsister has quit [Ping timeout: 240 seconds]
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<hcarty>
A simple test for my use-case, prints out multiple Hello lines as expected
<aantron>
ok nice :)
<hcarty>
aantron: Not really regression test material! :-) But it illustrates what I was hoping for functionality-wise
<aantron>
hehe yeah :)
<cheater>
i'm trying to #use a file in the interpreter, but it complains about not finding the module Core (which I'm using in that file). what am i supposed to do?
<cheater>
this is in the repl
yunxing_ has joined #ocaml
<aantron>
cheater: are you following some particular set of instructions? how did you install core?
<zozozo>
I just stumbled on a problem concerning the ocaml mailing list and dkim signatures, is it already known, or should I report it somewhere ?
<cheater>
i installed core via opam. i've now struck upon the right set of google keywords (core toplevel ocaml) so i'll try following what i've found there
ewanas has quit [Ping timeout: 260 seconds]
sepp2k has quit [Quit: Leaving.]
<hcarty>
cheater: Can you gist/pastebin/... the code you're #use-ing?
<aantron>
cheater: have you had success using #require instead of #use?
<aantron>
hcarty: yeah, to a first approximation, lwt.async and lwt_main are orthogonal. if the thread you ran async on does some kind of real I/O, lwt_engine will become involved... but thats orthogonal to whether you wrapped it in async or not.
<aantron>
(lwt_engine being called by lwt_main)
noplamodo has joined #ocaml
<aantron>
the thread just goes into the sea of lwt threads along with all others, and can be run during lwt_main
two_wheels has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<aantron>
so it's not inherently different from defining a big thread first, some of which may be run immediately, and some later, and then passing that to lwt_main
<hcarty>
aantron: Thanks! That's what I expected, but more from a "that seems like it would make sense" perspective rather than "I know the intended semantics"
<cheater>
this worked
<aantron>
hcarty: right :)
<cheater>
if i'm in async, and would like to read stdin, how do i best do this?
<cheater>
i'm in a function which is 'a -> unit Deferred.t = <fun>
<aantron>
cheater: so your problem with #use is resolved, is that correct?
<cheater>
yes thank you very much :-)
Algebr` has quit [Ping timeout: 250 seconds]
<cheater>
maybe doing this inside a deferred isn't the best idea, i don't know, it seems like async is only deferreds, hmm....
<cheater>
aantron: i don't think in_channel will fit inside a Defered
<aantron>
have to step away for a bit
<aantron>
yeah, it wont
Algebr` has joined #ocaml
<cheater>
so i'll use Reader
<aantron>
at least not politely
<cheater>
thank you
bensu has joined #ocaml
seangrove has joined #ocaml
bensu____ has quit [Ping timeout: 272 seconds]
walter|r has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
manud has quit [Ping timeout: 246 seconds]
hcarty has quit [Ping timeout: 240 seconds]
walter|r has quit [Ping timeout: 276 seconds]
pyon has joined #ocaml
dave24 has quit [Quit: leaving]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
manud has joined #ocaml
<cheater>
ok, i'm trying to use this Reader and Writer stuff and I figured out the Reader part but i'm not sure how to get a Deferred out of Writer. This is the code I'm trying to use: (Reader.really_read_line ~wait_time:(sec 5.) (Lazy.force Reader.stdin)) >>= (Writer.write_line (Lazy.force Writer.stdout));
<aantron>
hmm there should be some kind of flushing function. maybe you can wait using flushed, but i am not sure thats the right way
<cheater>
well there's this: val flushed : t -> unit Import.Deferred.t
<cheater>
flushed t returns a deferred that will become determined when all prior writes complete (i.e. the write() system call returns). If a prior write fails, then the deferred will never become determined.
<cheater>
but that doesn't look right
<aantron>
yeah thats what i meant. it almost looks right, except for dealing with failure
<aantron>
ok
<cheater>
i dunno about failure
<aantron>
the module comment answers this
<cheater>
go on?
<aantron>
see the 2nd parapgraph. actually, maybe you should link me to the version you are reading
<aantron>
ok yeah, same one. see the second paragraph
<cheater>
i don't really care about errors right now though, i'm just trying to get a Deferred out of Writer
<aantron>
then wait on flushed
<cheater>
ok
<cheater>
i've got another issue too.. apparently ocaml runs out of memory while building?
<aantron>
also i am not sure if Writer is the right module for basic work, but i don't know
<cheater>
so i changed that line to what's only on the left of bind. the line now reads: (Reader.really_read_line ~wait_time:(sec 5.) (Lazy.force Reader.stdin))
<aantron>
while building? can you be more specific as to what the problem is?
<cheater>
yeah.
<cheater>
was just copying
<cheater>
i get this error: $ corebuild -j 4 -pkg async,textutils chat_app.native; ./chat_app.native -client
<aantron>
i can only guess about that, since i dont know what corebuild really does. but core is a pretty large library, perhaps that has something to do with this. but i wouldnt expect running out of memory
<aantron>
i dont really use core, so i hope someone can help
<aantron>
(going to have to at least play with it some day though :p )
<cheater>
this is fairly crazy
<cheater>
want to try the code on your computer?
<aantron>
sure, can you make a gist/pastebin/whatever?
<cheater>
>>= (fun s -> (Core.Std.Option.iter s print_endline; return ()))
<cheater>
just had to let the types sink in
<cheater>
and the fact that ocaml doesn't care about purity
<aantron>
i guess that works. but if you were writing large strings or doing other IO where you want Core to actually intervene, i think you'd have to avoid print_endline
<cheater>
mhm
<cheater>
not the case here
<cheater>
thank you
fluter has joined #ocaml
StrykerKKD has joined #ocaml
Kakadu has quit [Remote host closed the connection]
nicholasf has joined #ocaml
nicholasf has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
Sorella has quit [Quit: Connection closed for inactivity]
nicholasf has joined #ocaml
mettekou has quit [Quit: My Mac has gone to sleep. ZZZzzz…]