<whitequark>
LLVM correctly identified that it has no side effects and transformed it into () :D
iorivur has joined #ocaml
<gasche>
whitequark: note that the semantics of this program, as an ML module, is to return a record that has the toplevel declaration as fields
<whitequark>
gasche: yes, but I had a testbench which wrapped everything in caml_program
<whitequark>
and that just returned unit.
<whitequark>
the way Cmm has integers mistyped as pointers really inhibits optimizations :/
boogie has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
boogie has quit [Ping timeout: 240 seconds]
dapz has joined #ocaml
dapz has quit [Client Quit]
dapz has joined #ocaml
dapz has quit [Client Quit]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<whitequark>
hm, well, the code it generates in the end is not too horrible, but the choices of the register allocator are, to put it mildly, questionable
<whitequark>
and seems like the inliner heuristics are all off for ocaml code
dapz has joined #ocaml
ikaros has joined #ocaml
iorivur has quit [Ping timeout: 245 seconds]
studybot has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
studybot_ has joined #ocaml
iorivur has joined #ocaml
studybot has quit [Ping timeout: 250 seconds]
maattdd has joined #ocaml
studybot_ has quit [Read error: Connection reset by peer]
knulp has joined #ocaml
ia0 has quit [Quit: leaving]
knulp has quit [Client Quit]
patojo has joined #ocaml
ia0 has joined #ocaml
elfring has joined #ocaml
patojo has quit [Ping timeout: 245 seconds]
slash^ has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ikaros has quit [Quit: Ex-Chat]
divyanshu has quit [Quit: Computer has gone to sleep.]
divyanshu has joined #ocaml
shinnya has joined #ocaml
<elfring>
OCamL prepares its own builds also with a configuration script.
<elfring>
I find that it contains some places which could be improved.
boogie has joined #ocaml
<adrien>
like?
boogie has quit [Ping timeout: 250 seconds]
cthuluh has quit [Ping timeout: 240 seconds]
<elfring>
1. Example: Should it be checked if the command "cd config/auto-aux" succeeds?
cthuluh has joined #ocaml
<adrien>
possible
<adrien>
but if it fails, everything else will fail too, which can be enough
<elfring>
2. Example: Does the call "../gnu/config.guess" need further considerations?
<adrien>
like?
<adrien>
(I don't think it does)
<elfring>
Will a configuration check be needed for the installation directory of "config.guess"?
Simn has quit [Ping timeout: 246 seconds]
<elfring>
Can this configuration script benefit anything from build system generators like Autotools (or CMake)?
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
* whitequark
grumbles
<whitequark>
ggole was right, Cmm is too low-level to be easily usable for a good LLVM back-end
<ggole>
:(
<whitequark>
to get results that are any good, I'd need aggressive unboxing, potentially changing ABI, and for that I'd really need to know types
<whitequark>
I mean, what I have right now can be probably wrangled into an usable backend, but it is hardly going to be significantly better than ocamlopt
<whitequark>
I guess I'll make a writeup and revisit it after I finish the current project
<gasche>
a usable LLVM backend has other advantages than performances
<gasche>
for example, you could try to do OCaml -> LLVM -> Emscripten -> asm.js
<whitequark>
gasche: what's the point, if you have js_of_ocaml?
<Axman6>
more eyes, more hands
<whitequark>
hm?
<gasche>
I would be interested in a performance comparison
<gasche>
but in the larger scheme of things
divyanshu has quit [Ping timeout: 250 seconds]
<gasche>
my point is that a large part of the mainstream compilation community is taking LLVM as a reasonable IR
<whitequark>
gasche: the problem with asm.js is that it's not directly comparable with js_of_ocaml, because you can't invoke javascript methods from asm.js
<ggole>
I wonder how bump-pointer allocation would work in asm.js
<gasche>
consider the possibility that PNaCl would take off: with an LLVM backend, OCaml would be immediately usable for low-level native stuff in the browser
<Axman6>
emscripten has more developers than I'd guess js_of_ocaml does, so I'd guess it'd produce better code
<whitequark>
ggole: the same way. it has a contiguous chunk of "virtual RAM"
<whitequark>
Axman6: see my response to gasche above, emscripten has very different scope
<gasche>
I'm not terribly interested in these things, but the general point is that having an LLVM backend can let us interact with those projects
divyanshu has joined #ocaml
<whitequark>
emscripten/asm.js (asm.js is just a formalization of emscripten output; it's useless on its own stand) are useful almost exclusively for porting legacy C libraries to browser
<gasche>
so it's a good long-term investment wrt. to not being totally isolated as a community
boogie has joined #ocaml
<ggole>
If an LLVM backend proves useful then it could be improved
<ggole>
Maybe by lowering from a higher IR than Cmm (which would be more work, I imagine).
<whitequark>
ggole: what I need is "Cmm with type info"
<whitequark>
OCaml seems to shed types pretty quickly though
<gasche>
what kind of type information?
<whitequark>
record layouts.
<gasche>
it would be nice if Flambda (Pierre Chambart's new IR) could be of use here
<gasche>
but I think it reconstructs typing information by analysis
<whitequark>
well, that could work too
<ggole>
Hmm, how would you represent sums accurately in LLVM?
<ggole>
Guarded casts?
boogie has quit [Ping timeout: 250 seconds]
<whitequark>
hmm, good question.
<whitequark>
I probably don't actually want to unbox sums.
studybot has joined #ocaml
studybot has quit [Remote host closed the connection]
studybot has joined #ocaml
ohama has quit [Ping timeout: 250 seconds]
studybot_ has joined #ocaml
dsheets has joined #ocaml
ohama has joined #ocaml
studybot has quit [Ping timeout: 250 seconds]
wwilly has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 276 seconds]
cthuluh has quit [Ping timeout: 252 seconds]
studybot has joined #ocaml
studybot_ has quit [Read error: Connection reset by peer]
studybot_ has joined #ocaml
studybot has quit [Ping timeout: 245 seconds]
cthuluh has joined #ocaml
tobiasBora has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
boogie has joined #ocaml
* whitequark
shrugs
<whitequark>
maybe it's not that a good idea after all
boogie has quit [Ping timeout: 250 seconds]
<whitequark>
context: I was writing a blog post, wrote a list of reasons to make an LLVM backend and it didn't quite convince myself
<gasche>
whitequark: writing something nuanced is fine
<gasche>
... as long as you do write :)
<mrvn>
it might just be good for llvm too.
<whitequark>
I think I'll revisit this after ppx_protobuf and fixing ctypes
<gasche>
isn't it better to write something now that it's fresh (or hot) in your head?
<gasche>
you can always revisit the discussion later if you have a better point of view
<whitequark>
I put most details in a draft and uploaded it to github
darkf has quit [Quit: Leaving]
<whitequark>
I don't like the idea of publishing it just yet, though
<gasche>
ok
<adrien>
elfring: OCaml cannot switch to autotools or anything else in the near future; it is too much work for now
<gasche>
I'm taking a break from format+gadts wrok by reading the "What have we learned in 20 years of L4 microkernels?" retrospective
<adrien>
whitequark: I believe most people in the OCaml community would prefer not to work on improving the performance of the compiler's output; it can be fun but it's a lot of work with huge competitors and there are other topics at the same time
<adrien>
gasche: I'm still waiting for (P)NaCl's adoption to rise; maybe the fact that I'm on firefox doesn't help but I doubt we'll see it any time soon
<elfring>
adrien: Are the involved software developers interested to convert the current script into an autoconf variant in principle?
<gasche>
adrien: yeah, I suspect it failed as a project
<whitequark>
adrien: I doubt we'll ever see it on IE
<gasche>
it was rather interesting, though
<adrien>
elfring: I can't tell but there are other tasks to do first in order to make the transition possible; maybe in a year or so
<adrien>
whitequark: IE and FF; mozilla has stated they wouldn't take it
<whitequark>
adrien: hm, what's their reasoning?
<whitequark>
too complex of an API?
<adrien>
gasche: it's nice but it's chrome/google
<adrien>
whitequark: that ^
<adrien>
it's everything but a standard
<elfring>
How do you think about to adjust the mentioned two places in the configuration script before a potential conversion to an autoconf approach?
<elfring>
Would you like to avoid unused function return values in shell scripts?
<adrien>
I've added a check for config/auto-aux in a local copy
<adrien>
for the second one, I don't think a change is needed
<adrien>
as for unused return values, do you have a specific example?
ygrek has quit [Remote host closed the connection]
Kakadu is now known as Kakadu_afk
ygrek has joined #ocaml
ollehar has joined #ocaml
<elfring>
Is the command "touch s.h m.h Makefile" the next update candidate?
Topher has joined #ocaml
Topher has left #ocaml []
<elfring>
How should the command "config.guess" work in environments for Microsoft Windows?
<adrien>
they don't
<adrien>
README.win32 explains everything
<elfring>
README.win32 explains not "everything" ...
<adrien>
it explains how to install on windows
<adrien>
if there's a gap in the documentation, you should understand that it doesn't work
<adrien>
I'm surprised at the number of F#-related links on reddit recently; it seems to finally start taking off for real
<elfring>
I imagine that an autoconf approach could help to support varaious run time environments (including Windows variants) better.
Thooms has joined #ocaml
<adrien>
autoconf requires a posix environment
<adrien>
cygwin/msys is such an environment which runs on windows
<whitequark>
and autoconf is really horrible
<adrien>
so, same
<adrien>
whitequark: no
<adrien>
a configure.ac file is simple
<adrien>
sure, if you look at .in files... but you might as well look at ocaml 2.x since it's the same timeframe
<elfring>
How do you think about to fiddle a bit more with m4 programming in configure.ac files?
<adrien>
first step is to make at least the Makefile and Makefile.nt files coherent
<adrien>
other things are something for later
Simn has joined #ocaml
boogie has joined #ocaml
<NaCl>
adrien: NaCl!
<adrien>
:]
<adrien>
\o/
pminten has quit [Quit: Leaving]
<NaCl>
wooo
<adrien>
I intend to resume work on caravel in a few weeks :D
boogie has quit [Ping timeout: 245 seconds]
Kakadu_afk is now known as Kakadu
<adrien>
gasche: I can confirm that the record field name disambiguation from context works; and that it makes it easy to produce code that is incompatible with earlier versions of ocaml
manizzle has quit [Ping timeout: 245 seconds]
Hannibal_Smith has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
racycle__ has joined #ocaml
<gasche>
adrien: there is a warning you can activate to make your code backwards-compatible
<gasche>
warning 42 :]
<adrien>
I think I remember wondering why I named some field differently a couple months ago; didn't think it could be linked to that now and I have to fix things now
<adrien>
hopefully the code is small and nothing hit "production"
<adrien>
heh :)
divyanshu has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
boogie has joined #ocaml
dapz has joined #ocaml
dapz has quit [Client Quit]
<adrien>
hmm
<adrien>
how do I enable a warning by its integer value in _tags for ocamlbuild?
boogie has quit [Ping timeout: 240 seconds]
<whitequark>
adrien: I think you need to edit myocamlbuild.ml
Hannibal_Smith has quit [Quit: Sto andando via]
<adrien>
='(
<whitequark>
I'm using flag ["ocaml"; "compile"] (S[A"-w"; A"@5@8@10@11@12@14@23@24@26@29@40"]);
<adrien>
I might start living with warn_A :D
<adrien>
I don't have a myocamlbuild.ml and I want to not have one (it's annoying when cross-compiling)
<whitequark>
oh
<adrien>
I can probably manage it but it'll take some thinking (which I need to do anyway since I'll have to cross-compile oasis-based libraries and I've actually already solved this but I've forgotten about it!)
pminten has joined #ocaml
Hannibal_Smith has joined #ocaml
<gasche>
adrien: tag warn(42)
<adrien>
ah, thanks
<adrien>
stupid me
<gasche>
(only in recent enough versions)
<adrien>
is 3.12.1? :D
kig has joined #ocaml
<adrien>
adding a warning to make sure the code is compatible with a given version but the warning itself isn't :D
<adrien>
warn(+42) actually
<adrien>
I'm not sure I understand: how can ocaml find out when I have an unused declaration in a .ml
<adrien>
does it look at the mli while compiling?
<mrvn>
more likely cmi
<adrien>
right
<adrien>
but I thought this was not doable or that there was some issue or something like tht
<adrien>
that*
<mrvn>
what kind of unused is it? let foo = 1 ... let foo = 1? Or a value that isn't used and not in the mli?
<adrien>
let x = 42
<adrien>
and it doesn't appear in the .mli
<adrien>
and let y = 43 appears in the mli
yacks has quit [Quit: Leaving]
divyanshu has joined #ocaml
<mrvn>
without looking at the mli/cmi you couldn't know the value is unused.
<adrien>
exactly
<mrvn>
==> it must look
<adrien>
but I'm fairly sure I read that some optimizations couldn't be done because they required knowing what was actually exported
tautologico has joined #ocaml
<mrvn>
% ocamlopt -c foo.ml
<mrvn>
File "foo.ml", line 1:
<mrvn>
Error: Could not find the .cmi file for interface foo.mli.
<adrien>
but you have a .mli file next to the .ml one
<mrvn>
yes
<ggole>
If there's no .cmi, then everything is visible/used
<mrvn>
if there is no .mli then ocamlc/opt write a .cmi
Eyyub has joined #ocaml
<adrien>
but actually, maybe that this issue was raised for dead-code elimination
<adrien>
and in that case, the current warnings are enough to find out about some dead code
<adrien>
hmmm
<adrien>
not in the final executable though and I think that was the topic
<mrvn>
sure. you might have y in the .mli but never use it in the final binary.
mcclurmc has joined #ocaml
<adrien>
gasche: heh, just found an annoying warning: Lib.(log dbg "Calling remove(`%s').\n" f);
<adrien>
Warning 44: this open statement shadows the value identifier log (which is later used)
<adrien>
well, obviously... :P
<mrvn>
isn't that the point of opening?
<adrien>
I'm wondering if the warning should be reduced for the Module.() case
<ggole>
Half the point of opening is to get unprefixed record labels.
<ggole>
Although not in that case...
<mrvn>
turning M.a M.b M.c ... M.x into M.(a b c ... x)
pminten has quit [Remote host closed the connection]
<adrien>
undoing all my uses of ambiguous record fields, I now clearly see the value of the feature
<adrien>
undoing is really painful
<mrvn>
Now you know why old C code has unique structure labels
<adrien>
and it's ven funnier on Windows
<adrien>
there are so many defines in the Microsoft headers that it's a minefield
divyanshu has quit [Quit: Computer has gone to sleep.]
divyanshu has joined #ocaml
boogie has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
clan has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
bunzen has quit [Remote host closed the connection]
<ygrek>
can someone please enlighten me on the status of lwt wrt react
<ygrek>
lwt from opam has conflicts on react = 1.0.0
<ygrek>
but it doesn't build with react 0.9.4 either
<ygrek>
or have I messed up something locally?
<ygrek>
aha, got it, lwt from git builds fine against react 1.0.0
<ygrek>
but when pinned it uses constraints from latest opam
<ygrek>
so the problem will be solved once lwt gets new release
<ygrek>
thanks!
<ygrek>
%)
cesar has joined #ocaml
cesar is now known as Guest4325
rgrinberg has joined #ocaml
oriba has joined #ocaml
<mfp>
ygrek: I just rebuilt/install the latest lwt linking against react 0.9.4. I did it by using a custom opam repository with a git url pointing to a local branch where I have reverted the 1.0.0 compat patch (because I had other stuff that needed 0.9.4)
wwilly has joined #ocaml
boogie has joined #ocaml
<mfp>
iow, use the custom repos to override the constraints from the latest opam. It's not as much work as it sounds (copy dscr and opam files into say lwt.2.4.4.1-custom under packages/ in the custom repos, echo 'git:"/home/mfp/src/lwt#custom-build"' > url then opam update my-repos && opam install lwt)
boogie has quit [Ping timeout: 240 seconds]
bholst has quit [Ping timeout: 258 seconds]
<ygrek>
mfp, yes, I did the same, just reverted the 1.0.0 commit
<ygrek>
no need for custom repo
<rgrinberg>
is ounit from opam broken for anyone else?
<rgrinberg>
nvm. had a wonky remote
<mfp>
ygrek: does it build directly for you with the "git" pin type (or are you using a "normal" pin?) I had to run the script that creates a release branch to get it to build.
<ygrek>
I use local pin
<ygrek>
btw ocsigen site says last lwt release was in 2012 %)
rgrinberg has quit [Quit: Leaving.]
_tca has quit [Ping timeout: 264 seconds]
IbnFirnas_ has quit [Ping timeout: 246 seconds]
Eyyub has quit [Ping timeout: 245 seconds]
IbnFirnas_ has joined #ocaml
_tca has joined #ocaml
_tca has quit [Changing host]
_tca has joined #ocaml
_tca has quit [Changing host]
_tca has joined #ocaml
boogie has joined #ocaml
dapz has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
clan has quit [Quit: clan]
divyanshu has quit [Quit: Computer has gone to sleep.]
Eyyub has joined #ocaml
ollehar has joined #ocaml
rgrinberg has joined #ocaml
Eyyub has quit [Ping timeout: 245 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
slash^_ has joined #ocaml
Guest4325 has quit [Remote host closed the connection]
ygrek has joined #ocaml
slash^ has quit [Ping timeout: 245 seconds]
Thooms has quit [Quit: WeeChat 0.3.8]
Thooms has joined #ocaml
nikki93 has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
slash^_ has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 240 seconds]
Eyyub has joined #ocaml
tautologico has quit [Quit: Connection closed for inactivity]
elfring has quit [Quit: ChatZilla 0.9.90.1 [Firefox 28.0/20140314220517]]
clan has joined #ocaml
Eyyub has quit [Ping timeout: 252 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
rgrinberg has joined #ocaml
ggole has quit []
tautologico has joined #ocaml
axiles has quit [Remote host closed the connection]
<tautologico>
in lacaml there's a common.mli that defines a signature for the Common module... but then in lacaml.mli there's a signature for the Common module again. I guess it's just to have it in the Lacaml module, but wouldn't it be better to use an include?
milosn has quit [Remote host closed the connection]
ohama has quit [Ping timeout: 240 seconds]
ohama has joined #ocaml
milosn has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
ollehar has quit [Ping timeout: 240 seconds]
<tobiasBora>
What is the cannonical way to get the string output given by a command ?
<tobiasBora>
Because Lwt_unix.system gives only an int of the process status
<adrien>
erm..........
<adrien>
use Batteries or Core
<tobiasBora>
adrien: And which function should I use ? I don't really know these library
<adrien>
dunno but I know they have something :P
<adrien>
Drup should be around
<mfp>
tobiasBora: if you're using Lwt, take a look at Lwt_process
<mfp>
<- I'm more concerned about the 2nd, as I have extended js_of_ocaml's syntax erm extension for easy object literal defs
<Drup>
object%js ... end ;)
clan has quit [Quit: clan]
* mfp
needs to get up to speed on extensions
<Drup>
you can read whitequark's blog post :p
<mfp>
I did read it, but didn't manage to remember enough of it to give you meaningful feedback on #144 --- or maybe I'm just to tired
<tautologico>
do most people avoid using -pack ?
<tautologico>
it seems more common to explicitly define a "main" module for a library
<mfp>
I'd say Core is almost the only real user :-P
<Drup>
pack is not convenient for a number of reason
<mrvn>
you need pack when you have multiple modules imho. Otherwise you take up too much namespace.
<mfp>
the short prefix thing works fine for e.g. Lwt_xxx
rgrinberg has quit [Quit: Leaving.]
<mrvn>
mfp: anyoing.
rgrinberg has joined #ocaml
<tautologico>
yes, but I've seen some libraries where they define an explicit module that includes other modules
<mfp>
better than having a single Lwt pack would do given pack's current limitations
<mfp>
also, the discussion on namespaces for the platform went nowhere
<tautologico>
Lacaml repeats a lot of signatures to contain everything inside a single Lacaml module, which I don't find very nice
<mfp>
and it looks like Core really needs them... hello world is what, 10MB (don't know really)?
<Drup>
tautologico: that's a different issue, which has to do with ocamldoc's weaknesses
<mrvn>
tautologico: but that leaves the original modules in the namespace too.
<tautologico>
mfp: yes, more or less 8-9Mb
<mrvn>
mfp: what limitations?
<mfp>
mrvn: everything being linked into the exec
nikki93 has joined #ocaml
<Drup>
mrvn: you can't pack optionnal part of your library
<mrvn>
mfp: ok, yes. that is ugly. I hope someone would fix that.
<Drup>
it's fixed in trunk, afaik
<mrvn>
We do static linking. So why isn't there dead code removal?
<tautologico>
mrvn: it's true, I was not sure about that
<Drup>
the simple fact that pack don't play well with optionnal part of a library is already a deal breaker for me
<mfp>
the side effects...
<tautologico>
it really surprised me first time using Core that a simple hello world executable would be so big
<Drup>
the other deal breaker is that I can't have types in the main modules if I use pack, I need to put them in a Foo.Types modules, which I don't like
<mrvn>
Drup: Like having IO and IO.Bigarray and then you always need Bigarray?
<Drup>
mrvn: yes
<mrvn>
Drup: that kind of falls under the dead code removal.
<mfp>
Drup: what's fixed? pack linking? (does it do purity checks to decide when it's safe to prune or something?)
<Drup>
mrvn: no, it doesn't
kig has quit [Quit: kig]
<Drup>
mrvn: I'm talking about optionnal dependecies at compile time of the libraries
<Drup>
mfp: afaik, yes
<mrvn>
Drup: which only give an error at compile time, at which point the linker should notice that they are dead code.
<Drup>
mrvn: that's not the issue ...
<mrvn>
Drup: then I don't get you
<mfp>
Drup: ooooh that's quite big, got a mantis issue num or something I can throw at google?
<Drup>
mfp: not really, sorry, some people (gasche ?) may know more
<Drup>
mrvn: let's say you have a library Foo, which contain various stuff and, you package it as findlib package foo. Then you have a sub library using js_of_ocaml that you want to package in findlib as foo.jsoo
<Drup>
if Bar is in the first and Baz the second, you can't pack Bar and Baz together
<mrvn>
Drup: then you need js_of_ocaml at link time, but only because there is no dead code removal.
<mfp>
I actually liked gasche's formalization of namespaces as seen by the OCaml compiler --- the proposals that followed seemed ad-hoc and thus incomplete in comparison
<Drup>
mrvn: you should be able to compile foo without js_of_ocaml
<Drup>
because it's *optionnal*
<tobiasBora>
I have an error I don't understand...
<Drup>
and if you start having pack with variable stuff inside depending on the environment when it was compiled, you open a big can of worm
<mrvn>
Drup: that seems to be a problem of your buildsystem then.
<Drup>
mrvn: no, that's a problem of you wanting to use pack when it's not needed
<mrvn>
Drup: I can build a pack with or without optional stuf just fine. Results in packs with different ABI/API as expected.
<tobiasBora>
And when I run it I get Error: This expression has type string but an expression was expected of type 'a Lwt.t
<Drup>
mrvn: precisely my point yes
<mfp>
tobiasBora: aren't you in the Lwt monad? (I assumed you were since you mentioned Lwt_unix first)
<Drup>
mrvn: you start breaking ocamlfind when you do that
<mrvn>
Drup: it is a different ABI/API. You excluded stuff.
<mrvn>
Drup: what you want is independent submodules, i.e. namespaces
<tautologico>
so basically creating a library entails a lot of boilerplate because of -pack and ocamldoc
<Drup>
oh sure, namespace solve my (non) problem
<Drup>
and pack don't
<tobiasBora>
mrvn: I don't understand what is a monad... I use it in an ocsigen page
<mrvn>
Drup: packs aren't namespaces.
<Drup>
which is exactly what I tried to tell you since the start :)
<mfp>
tobiasBora: it's OK then --- if you're already using it without realizing it :) just do let get_tmp () = Lwt_process.pread (Lwt_process.shell "date") and then in your service handler you do lwt tmp = get_tmp () in ...
<mrvn>
pack is great for packing a bunch of modules into a common meta module without having to write a big huge .mli file for it all.
<mrvn>
I tend to use begin/end unless it is a one-liner.
<mrvn>
tab1293: ( / begin after the first ->
<Drup>
tab1293: in this case, you could also do : match foo with | (x,(y,z)) -> ...
<mrvn>
tab1293: That way you can finish the expression with ) / end.
<Drup>
tab1293: you can nest patterns directly
<tab1293>
Okay thanks Drup and mrvn
<mrvn>
or even match gram with | (start, (lhs, rhs) as rules) ->
<tab1293>
nice I like that the best
<mrvn>
with "as" you can use the rules without having to construct a new touple. saves time and ram.
<mrvn>
tab1293: if in doubt add (...) around anything and see if that makes it work.
<Drup>
and sanity as a programmer
<Drup>
which is a far more valuable resources than RAM, in my opinion :D
<tobiasBora>
mfp: Oh... I though that >>= give 'a instead of 'a t. And it's possible to get a 'a type ?
<Drup>
tobiasBora: no
<Drup>
(and you shouldn't need it)
<tobiasBora>
Drup: So that mean that it's not possible to use Lwt in a "linear" program to get the string result of a shell comand ?
<Drup>
you can print :)
<Drup>
you don't need to have a 'a to print
tlockney_away is now known as tlockney
<tautologico>
I think an explicit namespace concept would be nice
<Drup>
"x >>= print_string" (or even better, "Lwt_io.print x") works perfectly for this kind of use
<mfp>
tobiasBora: in the end, the whole program is wrapped in Lwt_unix.run whatever (where whatever is, say, unit Lwt.t, and thus you get a () back when the thread is done)
<Drup>
tobiasBora: except that Lwt is not very usefull if your program is linear, since it's a concurency library
<tobiasBora>
I see ^^
<mfp>
(there actually are other "advanced" answers that give you the 'a out of the 'a Lwt.t, but you don't really want to know about them if you're not used to Lwt)
clan has joined #ocaml
Muzer has quit [Excess Flood]
Muzer has joined #ocaml
eizo has joined #ocaml
eizo has quit [Client Quit]
Thooms has quit [Ping timeout: 250 seconds]
Mandus_ is now known as Mandus
tlockney is now known as tlockney_away
clan has quit [Quit: clan]
clan has joined #ocaml
marr has joined #ocaml
nikki93 has quit [Remote host closed the connection]
<tab1293>
it has to do with the 2nd parameter of the else recursive call, the error is at the bottom of the pastebin
<Drup>
you need more paranthesis
<tab1293>
Drup: where at?
<Drup>
around the lists
<Drup>
make_new_rule_list t ([lhs]@rules_seen new_rules@[(lhs, [])])
<tab1293>
okay it works now
<tab1293>
I don't understand why I really need those parenthesis though
<Drup>
ocaml is whitespace insensitive
<Drup>
so your line was parsed as : "(make_new_rule_list t [lhs])@rules_seen new_rules@[(lhs, [])]
<tab1293>
gotcha thanks!
<tobiasBora>
Thank you everybody for your help, my program works now !
tobiasBora has quit [Quit: Konversation terminated!]
WraithM has quit [Ping timeout: 258 seconds]
madroach has quit [Ping timeout: 252 seconds]
madroach has joined #ocaml
<Drup>
have someone ever used valgrind with ocaml ?
darkf has joined #ocaml
<Drup>
I was just curious to see the result of cachegrind, but valgrind seems not to handle one of the instruction used by caml_io_mutex_lock and crash instantly after that
Anarchos has quit [Remote host closed the connection]
<tab1293>
So I know List.assoc will return the b of the matching a in [..(a,b)...] but how can I change b in place?
NoNNaN has quit [Remote host closed the connection]
<Drup>
lists are not mutable
<Drup>
you can't modify them in place
<Drup>
you can, however, return a new list where you changed the b
NoNNaN has joined #ocaml
<Drup>
(and writing the function is a good beginner exercise :p)