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
amiloradovsky has quit [Ping timeout: 260 seconds]
Jesin has joined #ocaml
olle has joined #ocaml
HyperMonkey has joined #ocaml
<HyperMonkey> is there a way to get an offline copy of real world ocaml without having to build it from its repository?
HyperMonkey has quit [Ping timeout: 245 seconds]
HyperMonkey has joined #ocaml
[mark] has joined #ocaml
mbuf has joined #ocaml
dborisog_ has joined #ocaml
chripell_ has joined #ocaml
sleepydog has quit [Read error: Connection reset by peer]
sleepydog has joined #ocaml
sleepyd0g has joined #ocaml
sleepydog has quit [Ping timeout: 260 seconds]
narimiran has joined #ocaml
jao has quit [Ping timeout: 260 seconds]
ferd has joined #ocaml
ferd has quit [Ping timeout: 265 seconds]
ferd has joined #ocaml
<hannes> I am curious about extensible variants, and thought they may be a match for the following problem (I'm happy to learn about other solutions as well): there's a entropy gathering thing which prefixes each n bytes of entropy with its 'source' (expressed as byte). certainly, there could be global knowledge of all sources, but that is a bit inconvenient. it would be nice to retain the invariant 'each source
<hannes> uses its own identifier (byte value) within a single program/executable'.
<hannes> so, I could define type source = .. ; type source += Timer -- and then define a let source_to_int = function Timer -> 0 | _ -> ??
<hannes> now, since here I don't have knowledge of all constructors (but all are nullary), is there a way to inspect the constructor? maybe Obj.tag which returns the tag of the constructor?
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<hannes> what seems to work is let t_to_int t = Obj.extension_id (Obj.extension_constructor t) -- but is this good? and what is the range of values returned?
<olle> HyperMonkey: buy it?
<olle> hannes: you want reflection?
<hannes> olle: no. I know the compiler assigns an int to each of the constructors anyways for e.g. pattern matching, I just want to get that int. (whereas 'reflection' I understand to figure out the type of a value at runtime)
<olle> ok
kvda has joined #ocaml
kvda has quit [Client Quit]
<hannes> reading more code and testing more, it looks like extensible variant constructor IDs are shared globally? (i.e. type t and type t' - when I add constructors to either, the ID for the next constructor of the other increases as well)
muskan has joined #ocaml
<Armael> hannes: instead of using extensible variants, why not have a function "get_new_source : unit -> int"
<Armael> this means that there will be global knowledge of all sources indeed, but with an extensible variant you sort of have it already (everyone has to be aware of the type definition)
<hannes> Armael: hmm. i like types (names) more than a registration function, but it is likely your approach is more mature
<Armael> I think you can have names if you want
<Armael> mmh, for instance, have your extensible variant, and a function "register_new_source : t -> int" that gives you a tag
<hannes> (likely 'get_new_source : string -> <my-private-int-type>', string used for printing, private-int to avoid anyone messing around with their own int (0))
<Armael> (and internally maintains an association list constructor-tag
<Armael> )
<hannes> yes, thanks Armael. after my brief excursion on how these ids are handed out by the runtime, I do not want to rely (put any invariants) on this mechanism. also, as usual, it is safer to stay away from obj
<def> (the IDs of extensible variant are just used for indexing purpose, their real identity is defined physically. actually, I think before 4.04, they didn't had any integer ID, just their physical address)
<olle> there's also sexp and deriving ppx stuff
sleepyd0g has quit [Ping timeout: 256 seconds]
<def> Also, the IDs of extensible variants is the same as IDs of objects -- actually runtime representation of a non-constant extensible variant is an object.
<def> The counters are implemented in runtime/obj.c: caml_set_oo_id, caml_fresh_oo_id :P. All there is to know about objects.
<hannes> thanks def
amiloradovsky has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
waleee-cl has joined #ocaml
kvda has joined #ocaml
<higherorder> Hello! Is anyone here using VSCode as their editor? I am having some issues with syntax highlighting at the toplevel
mfp has joined #ocaml
olle_ has joined #ocaml
muskan has quit [Remote host closed the connection]
ollehar_ has joined #ocaml
<olle> higherorder: try #vscode
HyperMonkey has quit [Remote host closed the connection]
pigeonv has joined #ocaml
Anarchos has quit [Remote host closed the connection]
Anarchos has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
vicfred has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
zebrag has joined #ocaml
inkbottle has quit [Ping timeout: 256 seconds]
waleee-cl has joined #ocaml
<olle> hm, websocket has to be used with either lwt or async?
HyperMonkey has joined #ocaml
<HyperMonkey> why does atdgen use polymorphic variants rather than, say, ordinary variants?
<HyperMonkey> ah one can explicitly request "classic" variants and it seems to generate code for that
Haudegen has joined #ocaml
<HyperMonkey> what type does span_of_x actually return in atdgen? is it `(X, string)` result or something else?
<HyperMonkey> I see some branches producing errors, like Atdgen_runtime.Oj_run.invalid_variant_tag
<olle> no idea what atdgen is, so don't ask me
<HyperMonkey> it's like s-expression marshaling/unmarshaling but for JSON
<HyperMonkey> but the successful branch ends in `(Variant tuple? : type)`, which doesn't look like a result case
<HyperMonkey> I would expect `Ok ...` if it were variant
<HyperMonkey> er, result that is
<olle> ah
<HyperMonkey> wait, there's an .mli I didn't read .. apparently the output type is just the type of the record
<HyperMonkey> so in other cases it must be raising an error?
<HyperMonkey> indeed oj_run.ml raises on line 22 (in error_with_line)
muskan has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oturtle has joined #ocaml
oturtle has quit [Ping timeout: 260 seconds]
jao has joined #ocaml
narimiran has quit [Ping timeout: 256 seconds]
pippijn_ has joined #ocaml
pippijn_ has quit [Client Quit]
oturtle has joined #ocaml
<HyperMonkey> can pattern match a record in a fun (lambda) parameters?
<HyperMonkey> I can't find an example of this in RWO but it seems reasonable that it might be possible
<pigeonv> do you have an example?
<theblatte> HyperMonkey: is it a case of using "function ..." (does pattern matching) instead of "fun ..." (doesn't)?
<HyperMonkey> theblatte hm, maybe
<HyperMonkey> let me try a bit with function and see if it works
<def> you can pattern match a record, it is just that you can only have a single case in a fun
<def> fun {Myrecord. field_a; field_b} -> ...
<theblatte> right, I guess "deconstruct" vs "pattern match" or something :)
<def> (It also works for sum types, if you have a way to make total matching, e.g fun (A x | B (x, _)) -> ...)
<theblatte> what would happen if the "fun" keyword behaved like "function"?
<theblatte> ah, "function" doesn't work for multiple arguments
<companion_cube> caml light did that :(
<def> :/
<theblatte> why is it sad?
<companion_cube> it had only one construct that did both `fun` and `function`, with multiple arguments
<theblatte> sounds nice /o\
<companion_cube> hmmm, since `.()` and `.{}` and the likes are scoped with modules
<companion_cube> why don't we do the same for `~$` for conversion from int?
<companion_cube> so that `Z.(1 + 2)` would work? :p
<HyperMonkey> well the record matching fun seem to be working (can't say 100% there are some other type errors in my code) .. thanks
<HyperMonkey> ocamlopt just produced a 20M binary for a program that uses a bit of async and does some JSON parsing ... other than that there is not much heavy use of libs. is this typical for ocaml native compilation size?
<companion_cube> async, as in `Async`? it depends on core iirc, and JST's libraries are not small
<HyperMonkey> will a dependency on core bring in all of it or is ocamlopt selectively pulling the used symbols?
<companion_cube> it brings a lot of it, becaues Core has a lot of internal co-dependencies (my knowledge is likely outdated)
<HyperMonkey> hm ok then I should probably look at porting my async code to lwt
<HyperMonkey> I insulated the async bits from the rest of my code so it should be easy
<companion_cube> you can also wait for someone more knowledgeable to tell you about async :p
<companion_cube> maybe there are ways of making it lighter
<HyperMonkey> well I've been thinking of dropping async for a while now, since that would also eliminate the jane-ppx dependency from the build
<companion_cube> if you want to avoid dependencies, JST stuff isn't the best indeed :D
cantstanya has joined #ocaml
dckc has quit [Ping timeout: 265 seconds]
cantstanya is now known as frank
frank is now known as cantstanya
dckc has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
Bluddy has joined #ocaml
<Bluddy> testing
<companion_cube> o/
<companion_cube> exciting
<companion_cube> ah that's not the bridge yet, is it?
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
discord_ocaml has joined #ocaml
<companion_cube> suspense…
<discord_ocaml> [discord] <companion_cube> oh!
<discord_ocaml> [discord] <Bluddy> yay
<discord_ocaml> [discord] <companion_cube> seems to work, even though it's not the prettiest
<companion_cube> o/ Bluddy and discord-bluddy
narimiran has joined #ocaml
<Bluddy> test2
<discord_ocaml> [discord] <Perry> IRC and Discord! Together again!
<companion_cube> so lovely
<theblatte> nice
<discord_ocaml> [discord] <Perry> How does it look on the IRC side?
<Drup> horribly
<companion_cube> it looks like a `discord_ocaml` person that has a lot of voices in their head
<discord_ocaml> [discord] <Bluddy> if you have advice on how to make it a little prettier, feel free to suggest.
<discord_ocaml> [discord] <Bluddy> we get nice pics of R2-D2 on this end
<theblatte> can we remove [discord] at least? ^^
<discord_ocaml> [discord] <Bluddy> yeah
<discord_ocaml> <Bluddy> trying
discord_ocaml has quit [Remote host closed the connection]
discord_ocaml has joined #ocaml
<companion_cube> oh hello
<Bluddy> testing
<discord_ocaml> <Bluddy> testing
<discord_ocaml> <Bluddy> test
discord_ocaml has quit [Remote host closed the connection]
discord_bot has joined #ocaml
<discord_bot> <Bluddy> test
<companion_cube> better
<theblatte> for me giving the bot as short a nick as possible would help too
<theblatte> yes better
<discord_bot> <Bluddy> dbot? will that be understood?
<companion_cube> sure
discord_bot has quit [Remote host closed the connection]
dbot_ has joined #ocaml
<companion_cube> if that isn't taken, that is
<dbot_> <Bluddy> how's this?
<theblatte> pretty good!
dbot_ has quit [Remote host closed the connection]
d_bot has joined #ocaml
<d_bot> <Bluddy> ok best I can get
<companion_cube> nice
zmt00 has joined #ocaml
<companion_cube> I think this will do
[mark] has quit [Quit: Konversation terminated!]
<d_bot> <Bluddy> ok so we're wired to #irc on this end for now. If all goes well, we can hook it up to #general instead.
<d_bot> <Bluddy> how much spam is irc getting these days?
<theblatte> not much at all, sometimes there a wave but the new settings are doing a good job at stopping these I think?
<theblatte> how much traffic does discord get? is d_bot going to drown everyone else? ;)
<theblatte> Bluddy: is there a way to reply to discord messages from irc?
<Bluddy> @bluddy
<Bluddy> I don't know
<theblatte> @bluddy hey
<Bluddy> no it doesn't work on the other side
<theblatte> k
<Bluddy> I'm trying different things
<Bluddy> <Bluddy>
<Bluddy> @Bluddy
<Bluddy> ok yeah
<Bluddy> so you can @ the name
<theblatte> cool
<companion_cube> ah it has to match the case
<Bluddy> yeah
<Bluddy> and emoticons don't transfer of course
<theblatte> :)
<companion_cube> @Perry coucou
<companion_cube> 👍
<theblatte> d_bot: /names
<d_bot> <Bluddy> test
<Bluddy> ok so edits are transferred
<theblatte> this is cool, thanks Bluddy!
<Bluddy> thank companion_cube -- he pointed me to some good bot software
<theblatte> isn't all software bot software?
<Bluddy> in a way...
chripell_ has quit [Ping timeout: 258 seconds]
muskan has quit [Remote host closed the connection]
muskan has joined #ocaml
Hrundi_V_Bakshi has joined #ocaml
<reynir> you should maybe look into registering d_bot with nickserv :)
<d_bot> <Bluddy> why is that important? you think someone else on freenode would want it?
<theblatte> if someone else takes it at a time when d_bot is down then you'll have to find another name for the bot afterwards
raver has joined #ocaml
<d_bot> <Bluddy> well, d_bot should never be down. I'd rather not register it to my email
<theblatte> registering doesn't need an email, just a (not too sensitive) password
<theblatte> if you've achieved 100% availability for your service I'm curious to learn how :)
Hrundi_V_Bakshi has quit [Quit: No Ping reply in 180 seconds.]
Hrundi_V_Bakshi has joined #ocaml
<companion_cube> @Bluddy so you're ok with registering to discord, but not freenode? :D
<d_bot> <Et7f3> Do you see all channel on IRC ? or only this one ?
<d_bot> <Et7f3> And `(Currently READ-ONLY!)` is still present but doesn't seem to be true.
<companion_cube> only this one
<simpson> You are only connected to the #ocaml channel on Freenode.
<companion_cube> well it just changed
<companion_cube> (the 'readonly' bit)
troydm has joined #ocaml
<mbuf> Is there a way to set a default value with 'opam switch'?
<d_bot> <Et7f3> Yes: `opam switch create [name] <package-or-version>` So `opam switch create my_custom_name ocaml-base-compiler.4.09` should work
andreas303 has joined #ocaml
HyperMonkey has quit [Ping timeout: 245 seconds]
<mbuf> d_bot, it creates it, but, it does not make it as default
dborisog_ has quit [Ping timeout: 240 seconds]
<d_bot> <Et7f3> opam switch set name
<mbuf> d_bot, so if I have a default switch ocaml-system.4.09.0, can I rename it to something else?
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
Bluddy has quit [Quit: Connection closed for inactivity]
<d_bot> <Et7f3> > opam switch set sets the default switch globally, but it is also possible to select a switch in a given shell session, using the environment. For that, use eval $(opam env --switch=SWITCH --set-switch).
<d_bot> <Et7f3> I would type: `opam switch set --switch=ocaml-system.4.09.0 --set-switch` to make it the default
<mbuf> d_bot, yes, I set that in ~/.bashrc; thanks!
mbuf has quit [Quit: Leaving]
<d_bot> <Et7f3> I think it is persitent if you use `opam switch set`
<d_bot> <undu> I never liked having "global" switches, I prefer per-session switches and a miniscript tomake it easy to change the switch locally
<waleee-cl> @undu sounds like direnv would fit your workflow nicely
<d_bot> <undu> I need to share switches between different directories and repos
<d_bot> <undu> The caching story in opam is not great right now
<waleee-cl> I see no problem with using the same switch in multiple .direnv ?
jao has quit [Read error: Connection reset by peer]
<d_bot> <undu> How would I use it? Current flow needs one command to change the loadef switch, the rest uses opam directly
<waleee-cl> oops I meant .envrc (shows how much I use direnv :)
<Fardale> @undu you can look at opam switch link for this kind of workflow
<waleee-cl> @undu you can use arbitrary sh in .direnvrc / .envrc, https://blog.differentpla.net/blog/2019/01/30/ruby-direnv/
<d_bot> <undu> I'll take a look, thanks
jao has joined #ocaml
<reynir> can't you also make a local switch and then put the projects that uses that switch within that dir?
<waleee-cl> Fardale nice, I didn't realise that that was what 'opam switch link' did
<waleee-cl> that must append something to .profile / .SHELLrc ?
<Fardale> No, it just create a simlink of the switch
<olle> why can't i compile the websocket-lwt example? missing some package but can't see which one
<olle> `ocamlfind opt -package lwt,websocket,websocket-lwt -thread wscat.ml`
<olle> Error: Unbound module Websocket_lwt_unix
<olle> but there's no such module with `ocamlfind list`
<olle> how can i know in which package the module is hidden?
<reynir> there's a websocket-lwt-unix on opam
<olle> yeah?
<olle> hm[ERROR] No package named websocket-lwt-unix found.
<olle> wrong ocaml version?
<olle> running opam update...
<reynir> I think you have to install it first, opam install websocket-lwt-unix
<waleee-cl> Fardale: ah, you need to use opam to execute eg. the ocaml-repl then? (a bit low on diskspace atm, hence the pestering)
<olle> reynir: that's what i did, and got the error message
Malani has joined #ocaml
muskan has quit [Ping timeout: 245 seconds]
<reynir> hmm, maybe it conflicts with websocket-lwt -- the latest version number for websocket-lwt-unix is higher than websocket-lwt
<waleee-cl> ... to answer my own question; yep you needed to use 'opam exec ocaml' to get the linked switch instead of the default one
Malani has quit [Client Quit]
sleepydog has joined #ocaml
<olle> reynir: yeah? thanks for the tip, will check
<reynir> there should've been a conflicts thingie in the opam file if so - please consider opening a pr / issue if so :)
narimiran has quit [Ping timeout: 265 seconds]
<olle> reynir: you're the author?
<reynir> No
<olle> ok
<Fardale> waleee-cl: oh yes, you need the basic line in your .profile
<reynir> I think one of the examples is named after me though hah
asoni has joined #ocaml
asoni is now known as anuragsoni
tane has joined #ocaml
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #ocaml
Hrundi_V_Bakshi has quit [Quit: No Ping reply in 180 seconds.]
<olle> reynir: ok, so *where* did you find websocket-lwt-unix?? i can't find it
<olle> opam search websocket does not list it
<olle> i'm on an ARM cpu, dunno if it matters
ferd has quit [Quit: Lost terminal]
Hrundi_V_Bakshi has joined #ocaml
<reynir> I have no idea
<olle> why wouldn't it be listed in opam?
<olle> hm
<olle> so weird
<reynir> what version of ocaml are you running?
<olle> 4.05
<olle> opam 1.2.2
<reynir> Ah, it requires 4.06
<reynir> does opam show websocket-lwt-unix show anything?
<olle> fuck me
<olle> not literally
<olle> only
<olle> [ERROR] No package named websocket-lwt-unix found.
<olle> hm hm
<olle> now i see on the opam page
<reynir> opam search --all maybe shows it?
<olle> unknown option --all
<d_bot> <undu> opam list | grep lwt
<reynir> oh, opam 1.2.2
<olle> updating my system now
<reynir> didn't the repository freeze for 1.2.2 ?
<olle> apt udpate etc
<olle> freeze?
<reynir> yea, I'm not sure the repository for opam 1.2.x still gets new packages
<d_bot> <undu> it doesn't
<anuragsoni> reynir: I believe the 1.2 repository is frozen indeed. It is on its own branch in opam-repository git repo (branch name is 1.2)
anuragsoni is now known as Anurag
Anurag has quit [Quit: Anurag]
Anurag has joined #ocaml
Anurag has quit [Client Quit]
jao has quit [Remote host closed the connection]
lobo has joined #ocaml
<Fardale> olle: maybe it is a opam 2.* package only
jao has joined #ocaml
vicfred has quit [Quit: Leaving]
webshinra has joined #ocaml
Hrundi_V_Bakshi has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Hrundi_V_Bakshi has joined #ocaml
Hrundi_V_Bakshi has quit [Client Quit]
vicfred has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
tane has quit [Quit: Leaving]
Anarchos has joined #ocaml
HyperMonkey has joined #ocaml
<HyperMonkey> I'm trying to link with compiler-libs: `ocamlfind ocamlopt -package compiler-libs main.ml` but I get `No implementations provided for the following modules` listing Printlambda, Translmod, Compile_common. how I can fix?
<HyperMonkey> added `-linkpkg` to no avail
<companion_cube> you may want compiler-libs.common, too
<companion_cube> there are several sub-libraries in compiler-libs
<HyperMonkey> oh nice that did it. thanks
<companion_cube> 🎉
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
sagax has joined #ocaml
vicfred_ has joined #ocaml
vicfred has quit [Ping timeout: 260 seconds]
kvda has joined #ocaml
jao has quit [Remote host closed the connection]