adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
zgasma has quit [Ping timeout: 265 seconds]
spew has quit [Quit: Connection closed for inactivity]
serge_ has joined #ocaml
smazga has joined #ocaml
serge_ has quit [Ping timeout: 260 seconds]
smazga has quit [Ping timeout: 240 seconds]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
ygrek__ has quit [Remote host closed the connection]
ygrek__ has joined #ocaml
ygrek__ has quit [Ping timeout: 260 seconds]
malina has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
olle has quit [Ping timeout: 272 seconds]
olle has joined #ocaml
serge_ has joined #ocaml
serge_ has quit [Ping timeout: 260 seconds]
ygrek__ has joined #ocaml
serge_ has joined #ocaml
ygrek__ has quit [Ping timeout: 240 seconds]
serge_ has quit [Ping timeout: 260 seconds]
nullifidian_ has joined #ocaml
nullifidian__ has quit [Ping timeout: 265 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 265 seconds]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
nullifidian has joined #ocaml
nullifidian_ has quit [Ping timeout: 265 seconds]
mfp has quit [Ping timeout: 272 seconds]
Nikkel has quit [Ping timeout: 272 seconds]
Nikkel has joined #ocaml
Haudegen has joined #ocaml
serge has joined #ocaml
tormen_ has joined #ocaml
TakinOver has joined #ocaml
lnxw37d4 has joined #ocaml
tormen has quit [Ping timeout: 260 seconds]
serge has quit [Ping timeout: 268 seconds]
mbuf has joined #ocaml
<nicolaus> GOod day, I am using () to indicate this should be ran first, but other functions above it are ran first
<nicolaus> I am using () to indicate that it's my sort of "main" function
<nicolaus> Ok, got it
<nicolaus> I just added () to all functions that has names and may "main" function only has ()
<nicolaus> I don't understand it though
dash has joined #ocaml
<dash> nicolaus: since we didn't see your code, neither do we
_whitelogger has joined #ocaml
smazga has joined #ocaml
ggole has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
pierpal has joined #ocaml
dash has quit [Ping timeout: 240 seconds]
gravicappa has joined #ocaml
nullifidian has quit [Read error: Connection reset by peer]
nullifidian_ has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
narimiran has joined #ocaml
vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
mbuf has quit [Ping timeout: 265 seconds]
mbuf has joined #ocaml
kleisli has quit [Ping timeout: 265 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 268 seconds]
<Leonidas> nicolaus: I think you're ascribing a meaning to () that just isn't there.
<Leonidas> nicolaus: your functions execute in the order you call them in your module
<Leonidas> if you call the functions before your main function then this is when they will execute
serge has joined #ocaml
serge has quit [Ping timeout: 240 seconds]
dborisog has joined #ocaml
LanceMarsh has joined #ocaml
Serpent7776 has joined #ocaml
<LanceMarsh> hi, ocaml masters: why does `One h::t` matches `type 'a node = One of 'a | Many of 'a node list;;` where 'a is string? first day learning ocaml, trying to solve the 7th problem of 99 problems(https://ocaml.org/learn/tutorials/99problems.html).
<vsiles> LanceMarsh: can you show some code ?
<LanceMarsh> vsiles: of course, http://sprunge.us/5SgpMv
<LanceMarsh> here's the code i came up with: http://sprunge.us/HKROoi
Nikkel has quit [Ping timeout: 240 seconds]
<vsiles> LanceMarsh: if you look at the type of your flatten function, you'll see that ocaml infers it to be
<vsiles> val flatten : 'a node list -> 'a list
<vsiles> there's no mention of strings anywhere, because you always manipulate the nodes without testing the actual data stored in it
<vsiles> so `One h::t` doesn not match a string node
<vsiles> it match a 'a node list
<vsiles> Usually functions like 'flatten' take some list of lists to a simple list. Here the goad is to to take a list of nodes (which can be seen as a list of list) and produce a plain list
<vsiles> not sure why you mention string
<LanceMarsh> testcase is flatten [ One "a" ; Many [ One "b" ; Many [ One "c" ; One "d" ] ; One "e" ] ];;
<LanceMarsh> i thought the pattern was to match somethign like `One "a"`
Nikkel has joined #ocaml
<vsiles> So split up the type involved. In your test case, the argument is [ One "a"; .... ] which is a list (because of the surrounding [])
<vsiles> In this list, you have One "a", Many [ ... ] and One "e" which are all string node
<vsiles> so the overall type is string node list, which matches with your function types: 'a node list -> 'a is substituted with string
<vsiles> oh I see now your issue
<vsiles> sorry, was multitasking
<vsiles> in your reference code
<vsiles> One h :: t has to be read (One h) :: t
<vsiles> it's a nested pattern matching rule which triggers if the input is a list which heads is a `One _`
<LanceMarsh> Ah, that ^ explains everything! Thank you very much
<vsiles> it is _not_ One (h :: t)
<Leonidas> the precedence of :: is a bit surprising sometimes
mahtob has joined #ocaml
mahtob has quit [Read error: Connection reset by peer]
mahmudov has quit [Ping timeout: 272 seconds]
Cypi_ is now known as Cypi
lnxw37d4 has quit [Quit: killed]
bglm[m] has quit [Quit: killed]
ziyourenxiang has quit [Ping timeout: 268 seconds]
serge has joined #ocaml
ziyourenxiang has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
ollehar_ has joined #ocaml
mbuf has quit [Quit: Leaving]
mahmudov has joined #ocaml
dborisog has quit [Ping timeout: 260 seconds]
aecepoglu[m] has joined #ocaml
aspiwack[m] has joined #ocaml
bglm[m] has joined #ocaml
cgenie[m] has joined #ocaml
flux has joined #ocaml
dl3br[m] has joined #ocaml
jimt[m] has joined #ocaml
keep-learning[m] has joined #ocaml
lnxw37d4 has joined #ocaml
pablo[m] has joined #ocaml
dash has joined #ocaml
peddie has joined #ocaml
prsafont[m] has joined #ocaml
zapashcanon[m] has joined #ocaml
zwindl[m] has joined #ocaml
karan has joined #ocaml
tiksin[m] has joined #ocaml
sepp2k has joined #ocaml
LanceMarsh has quit [Quit: WeeChat 2.7]
mfp has joined #ocaml
<gahr> is there a way to build a string from the contents of a file at compile time?
<Leonidas> gahr: yes, there is ppx_blob
<Leonidas> lobsters is the one page on the internet where there's more ocaml-fans than haskell and in systemd discussions you see all the names from here :)
ocaml459 has joined #ocaml
<gahr> thanks Leonidas - do you also happen to know whether incr_dom supports ajax requests somehow?
<Leonidas> gahr: I don't use incr_dom so maybe there's a reason why that's not possible, but since you're probably using jsoo you can just do xmlhttprequest yourself?
<gahr> yes i just don't know how to integrate that with incr_dom view / apply_action / update model cycle
<Leonidas> Ah I see, sorry, I don't have a solution for this at hand.
<gahr> np thanks
serge has joined #ocaml
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
ocaml459 has joined #ocaml
serge has quit [Ping timeout: 272 seconds]
ocaml459 has quit [Client Quit]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
dhil has joined #ocaml
SpiceGuid has joined #ocaml
dborisog has joined #ocaml
ocaml459 has joined #ocaml
ehirdoy has quit [Quit: WeeChat 1.4]
bartholin has quit [Quit: Leaving]
FreeBirdLjj has joined #ocaml
serge has joined #ocaml
<gahr> Error: Ppx dependency on a non-ppx library "ppx_blob". If "ppx_blob" is in
<gahr> fact a ppx rewriter library, it should have (kind ppx_rewriter) in its dune
<gahr> file.
<gahr> does this suggest anything?
<vsiles> can you share your dune file ?
<gahr> (executable (name main) (libraries incr_dom) (preprocess (pps js_of_ocaml-ppx ppx_jane)) (preprocessor_deps (file data/bio-en.html) (file data/bio-it.html)) (modes js))
<gahr> ehm.. I removed ppx_blob from the preprocess stanza
<gahr> it errs if it's there
serge has quit [Ping timeout: 272 seconds]
smazga has joined #ocaml
<gahr> (executable (name main) (libraries incr_dom) (preprocess (pps ppx_blob)))
<gahr> this fails
<vsiles> remove the pps
<vsiles> oh
<vsiles> no
<vsiles> don't do that :D
<vsiles> dunno how it works... ask the dev on github ?
<gahr> ok
<gahr> I guess the published version doesn't work well with opam.. current master is better
<gahr> as in, it errors on a different thing :)
smazga has quit [Ping timeout: 260 seconds]
SpiceGuid has quit [Quit: ChatZilla 0.9.93 [SeaMonkey 2.49.4/20180713174829]]
ostera has joined #ocaml
kleisli has joined #ocaml
<Leonidas> I think there was some dune change where it won't use a ppx if it wasn't compiled with some flag.
<gahr> I guess ppx_blob just didn't expose a proper dune-package
<rgrinberg> I think the change was that you can't have a ppx_rewriter in (libraries ..) if you aren't a ppx_rewriter yourself
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Haudegen has quit [Quit: Bin weg.]
pierpal has quit [Read error: Connection reset by peer]
Serpent7776 has quit [Remote host closed the connection]
Serpent7776 has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
FreeBirdLjj has quit [Remote host closed the connection]
pierpal has joined #ocaml
Haudegen has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
pierpal has quit [Ping timeout: 260 seconds]
serge has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
mahtob has joined #ocaml
brettgilio has quit [Ping timeout: 240 seconds]
mahtob has quit [Remote host closed the connection]
mahmudov has quit [Ping timeout: 260 seconds]
brettgilio has joined #ocaml
mahmudov has joined #ocaml
RalfJ has quit [Ping timeout: 272 seconds]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
dhil has quit [Ping timeout: 248 seconds]
decentpenguin has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 265 seconds]
ocaml459 has joined #ocaml
<Armael> Leonidas: woo nice job on the systemd-trolling post on lobsters
<Armael> you expressed my thoughts exactly
<Armael> it's really magical how the thread unfolds
<companion_cube> ♥ Leonidas
ocaml459 has quit [Client Quit]
<Armael> the "oh no, a PARSER" is really funny, given how bad shell is on that aspect
<Leonidas> likewise, when I read the "good" example of using shell there for a moment I wasn't sure they were being serious so Armael's response is the only sensible answer
<Armael> :D
<Armael> yes that's quite amazing
<Leonidas> Armael: but I think my main frustration is comments like this: https://lobste.rs/s/nameqe/why_suckless_is_wrong_2016#c_s2mtvi
<Leonidas> He literally writes that he knows nothing about it so he claims it sucks.
<Armael> :D yeah, but what can you do *shrug*
<companion_cube> tbh I wouldn't mind a somewhat simpler systemd-like in rust
<companion_cube> but you can pry units from my cold dead hands
<Armael> yeah, I don't care so much for systemd itself than for the declarative units and the useful baked-in features
<Armael> I wouldn't mind something else (not written in C for instance) with that features
<companion_cube> right? and how hard is it to write a init parser…
<Leonidas> I agree, picking C is an odd choice and it seems to be written in a pretty crappy way, given how often issues get reported
<companion_cube> (which is more or lss the syntax)
<Armael> but then I find it strange that alternatives seem to focus on shell scripts or similar
<companion_cube> write your init in Coq Armael
<Armael> sure!
<Armael> i'll do that over the week end
<Leonidas> companion_cube: I once enabled some process isolation in an unit file and was laughing to me how many hundreds of lines of unreadable shell that would equal to
<Leonidas> but it was just one line in the unit file
<Armael> yes! the isolation features are really nice! and you just have to toggle one or two options
<simpson> Leonidas: Around 100 lines, actually: https://github.com/p8952/bocker
<flux> OCaml would be quite a suitable language for implementing a systemd as well. in fact, a "second implementation" of systemd would probably be good for everyone involved.
<Leonidas> to the point it seems feasible to just stick that line into all kinds of unit files and see how much a system can be hardened for free
<Leonidas> simpson: this actually does somewhat more than necessary :-)
<simpson> Leonidas: Ah, so it sounds like it would take *less than* a single hundred of lines of unreadable shell.
Serpent7776 has quit [Quit: Leaving]
RalfJ has joined #ocaml
<Leonidas> simpson: or different ones, I don't know how well bocker does error handling
<Leonidas> that's often the catch with bash, if you just write the happy path then it is easy and reasonably fun, but handling failure becomes quite difficult since you'll have to start handling failures everywhere and it doesn't compose particularly well
RalfJ has quit [Ping timeout: 272 seconds]
<dash> I did like that implementation of git in sh recently
<dash> (appropriately named "shit")
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
<companion_cube> I haven't even tried the isolation stuff
<companion_cube> but ocabot runs on systemd (as its siblings) and it's super reliable
mbuf has joined #ocaml
kleisli has quit [Ping timeout: 265 seconds]
RalfJ has joined #ocaml
dhil has joined #ocaml
ocaml459 has joined #ocaml
<dash> ocaml is special because there's Mirage
ocaml459 has quit [Client Quit]
RalfJ has quit [Ping timeout: 272 seconds]
<mbuf> Is there a way to dump a list from OCaml to a file, and be able to read it back?
<mbuf> Or any other data structure?
RalfJ has joined #ocaml
<companion_cube> feels to me like mirage is moving a bit too fast
<companion_cube> mbuf: marshal or some deriving thing?
<companion_cube> (depending on the tradeoff convenience/interop/safety you want)
m_oss has joined #ocaml
<mbuf> companion_cube, okay
<companion_cube> ppx_deriving_yojson or whatnot I imagine
<companion_cube> or writing serializers/deserializers yourself
<Armael> companion_cube the old geezer
<companion_cube> (I mean with combinators)
kleisli has joined #ocaml
FreeBirdLjj has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
decentpenguin has quit [Ping timeout: 260 seconds]
decentpenguin has joined #ocaml
serge has joined #ocaml
<mbuf> For "let oc = Stdio.Out_channel.create file in fprintf oc "%s\n" m;", why do I get "Error: Unbound value fprintf" Hint: Did you mean bprintf, ifprintf or sprintf? I am compiling using ocamlfind ocamlc - thread -package base -package core file.ml
serge has quit [Ping timeout: 260 seconds]
<vsiles> mbuf: maybe `Printf.fprintf` ?
spew has joined #ocaml
<vsiles> or Stdio.printf
<mbuf> vsiles, I tried that. It says "Error: Unbound value Printf.fpritf"
<companion_cube> ^ typo
<companion_cube> you forgot an 'n'
<mbuf> vsiles, same for Stdio.fprintf.
<mbuf> Same for Printf.fprintf
<companion_cube> seems like sometimes the stdlib is simpler 🙃
<vsiles> can replicate here
<vsiles> mbuf: for the Stdio version, the right name is Stdio.Out_channel.fprintf
<mbuf> vsiles, yes, just tried it now, and it works.
<mbuf> vsiles, also, had to use Stdio.Out_channel.close
<mbuf> vsiles, thanks!
<vsiles> you're welcome
<mbuf> Why is -linkpkg required?
<vsiles> nfi
<mbuf> vsiles, sorry, nfi?
<companion_cube> why are you compiling by hand?? :/
<mbuf> companion_cube, just to try out the functions
FreeBirdLjj has quit [Remote host closed the connection]
<companion_cube> use utop then
<companion_cube> much simpler ;)
Serpent7776 has joined #ocaml
m_oss has quit [Quit: Leaving]
<mbuf> companion_cube, it worked with utop, but, I want to be able to pass CLI arguments
<mbuf> companion_cube, later, to use it as a script
<companion_cube> ah…
<companion_cube> #!/usr/bin/env ocaml … can do it then, although it's a bit meh imho
ollehar_ has quit [Ping timeout: 245 seconds]
<vsiles> mbuf: no fucking idea
<vsiles> n f i
<mbuf> vsiles, okay
bartholin has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
Haudegen has quit [Quit: Bin weg.]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
kleisli has quit [Remote host closed the connection]
kleisli has joined #ocaml
dborisog has quit [Ping timeout: 265 seconds]
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
kakadu has joined #ocaml
ocaml459 has joined #ocaml
porchetta has quit [Ping timeout: 245 seconds]
hannes has quit [Ping timeout: 268 seconds]
mbuf has quit [Quit: Leaving]
hannes has joined #ocaml
Haudegen has joined #ocaml
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
nullifidian_ has quit [Read error: Connection reset by peer]
nullifidian_ has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 240 seconds]
igitoor has quit [Ping timeout: 240 seconds]
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
ocaml459 has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
sagax has quit [Ping timeout: 268 seconds]
dhil has quit [Ping timeout: 240 seconds]
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 265 seconds]
malina has joined #ocaml
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pierpal has joined #ocaml
TC01_ has joined #ocaml
pierpal has quit [Ping timeout: 265 seconds]
TC01 has quit [Ping timeout: 268 seconds]
nicoo has quit [Remote host closed the connection]
ocaml459 has joined #ocaml
sagax has joined #ocaml
Hrundi_V_Bakshi has quit [Quit: No Ping reply in 180 seconds.]
Hrundi_V_Bakshi has joined #ocaml
kleisli has quit [Ping timeout: 265 seconds]
amiloradovsky has joined #ocaml
ggole has quit [Quit: Leaving]
nicoo has joined #ocaml
serge has joined #ocaml
serge has quit [Ping timeout: 260 seconds]
pierpal has joined #ocaml
igitoor has quit [Ping timeout: 248 seconds]
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #ocaml
pierpal has quit [Ping timeout: 240 seconds]
ygrek__ has joined #ocaml
narimiran has quit [Ping timeout: 240 seconds]
decentpenguin has quit [Quit: decentpenguin]
GreyFaceNoSpace has joined #ocaml
GreyFaceNoSpace has quit [Client Quit]
ocaml459 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
amiloradovsky has quit [Ping timeout: 248 seconds]
gravicappa has quit [Ping timeout: 272 seconds]
serge_ has joined #ocaml
mal`` has quit [Quit: Leaving]
serge_ has quit [Ping timeout: 260 seconds]
mal`` has joined #ocaml
ocaml459 has joined #ocaml
ocaml459 has quit [Client Quit]
pierpal has joined #ocaml
kakadu_ has quit [Ping timeout: 246 seconds]
ygrek__ has quit [Ping timeout: 260 seconds]
GreyFaceNoSpace has joined #ocaml
pierpal has quit [Ping timeout: 260 seconds]
serge_ has joined #ocaml
serge_ has quit [Ping timeout: 265 seconds]
kleisli has joined #ocaml