adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
iovec has quit [Quit: Connection closed for inactivity]
bugabinga has quit [Remote host closed the connection]
<lorp> Q: i'm having a pattern in my code where i need to match over a union type just to assert that i have the expected tag in hand (and extract its data) - so it's basically "match x with | `MyThing a -> stuff | _ -> assert false", is there a terser / more idiomatic ocaml way of doing this?
pierpal has quit [Ping timeout: 244 seconds]
<_y> no
<_y> you may put this in a function `as_my_thing`
spew has quit [Quit: Connection closed for inactivity]
<lorp> thanks _y, but can i pass `MyThing` as an argument to make that a generic `as_a_thing` function? (i guess not)
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<_y> alternatively, you may write a non-exhaustive pattern-matching and locally disable the warning about it: let[@warning "-8"] (`MyThing a) = x in stuff
<_y> but i believe that’s not approven style
<lorp> oh interesting, was not familiar with that! ye, i probably have a design flaw somewhere, i'm new to ocaml :)
<lorp> thank you 🙏
<_y> lorp, on your second question, this won’t work; however you may achieve something similar with GADTs, with a witness value, but that’s likely not for beginners (if for anyone) ;-)
<lorp> i might just stick with the verbose version until i learn some more, and then refactor to try and avoid the scenario completely
<_y> that is wiser
mfp has quit [Ping timeout: 246 seconds]
orbifx has quit [Ping timeout: 244 seconds]
kvda has joined #ocaml
pierpal has joined #ocaml
silver has quit [Quit: rakede]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
madroach has quit [Ping timeout: 264 seconds]
dmiles has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
dmiles has joined #ocaml
tormen_ has joined #ocaml
tormen has quit [Ping timeout: 268 seconds]
AnAverageHuman has joined #ocaml
gravicappa has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
AnAverageHuman has joined #ocaml
ansiwen has quit [Quit: ZNC 1.7.1 - https://znc.in]
ansiwen has joined #ocaml
marvin2 has quit [Ping timeout: 268 seconds]
_whitelogger has joined #ocaml
madroach has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
iovec has joined #ocaml
sagotch has joined #ocaml
_whitelogger has joined #ocaml
jao has quit [Remote host closed the connection]
jao has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
freyr69 has joined #ocaml
sagotch has quit [Quit: Leaving.]
Guest37220 has joined #ocaml
themsay has joined #ocaml
sagotch has joined #ocaml
sagotch has quit [Remote host closed the connection]
status402 has joined #ocaml
<freyr69> How to specify that the result type of my function is a subtype of t?
<freyr69> In case of polymorphic variants
<freyr69> something like `f : int -> ([ `A | `B ] :> res)`
iovec has quit [Quit: Connection closed for inactivity]
sgnb has quit [Remote host closed the connection]
status402_ has joined #ocaml
status402 has quit [Read error: Connection reset by peer]
mfp has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
iovec has joined #ocaml
themsay has quit [Ping timeout: 250 seconds]
ygrek has joined #ocaml
picolino has quit [Ping timeout: 244 seconds]
picolino has joined #ocaml
<zozozo> freyr69: `f : int -> [< `A | `B ]` (`[< #foo ] design any subtype of foo iirc), but if that's the output of your function, you should be able to tell precisely what it cna output or not ?
marvin2 has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freyr69> zozozo: Yes, I want to specify that [ `A | `B] is a subtype of [`A | `B | `C]
<zozozo> ah, well, just cast the result of the function: `(f 5 :> [`A | `B | `C])`
ollehar has joined #ocaml
gravicappa has quit [Remote host closed the connection]
kakekongen has quit [Ping timeout: 250 seconds]
q9929t has joined #ocaml
jaar has joined #ocaml
orbifx has joined #ocaml
q9929t has quit [Quit: q9929t]
<cemerick> Any ideas what this means? `No implementations provided for the following modules: Unix referenced from src/foo.cmxa(Bar)`
<cemerick> `Unix` is in the stdlib ???
SpiceGuid has joined #ocaml
<zozozo> cemerick: Unix is in the stdlib but must be linked explicitely (contrary to most other modules in the stdlib)
<cemerick> zozozo: using dune? Very confusing, as I'm getting this error after moving some code from my tests into a library, where the former didn't do anything to link Unix explicitly.
<zozozo> cemerick: using dune, juste add unix to the "libraries" field
<cemerick> zozozo: oookay, it must have been carried along by ounit 👍
asymptotically has joined #ocaml
kakekongen has joined #ocaml
status402_ has quit [Quit: status402_]
status402 has joined #ocaml
Haudegen has joined #ocaml
gsg has joined #ocaml
gsg has left #ocaml [#ocaml]
silver has joined #ocaml
wilfredh has quit [Quit: Connection closed for inactivity]
ggole has joined #ocaml
SpiceGuid has quit [Quit: ChatZilla 0.9.93 [SeaMonkey 2.49.4/20180713174829]]
mfp has quit [Ping timeout: 268 seconds]
decentpenguin has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
_whitelogger has joined #ocaml
kjak has quit [Ping timeout: 272 seconds]
spew has joined #ocaml
cross has quit [Quit: leaving]
decentpenguin has quit [Quit: WeeChat 2.3]
cross has joined #ocaml
nc8 has joined #ocaml
mfp has joined #ocaml
SpiceGuid has joined #ocaml
status402 has quit [Quit: status402]
status402 has joined #ocaml
status402 has quit [Remote host closed the connection]
status402_ has joined #ocaml
bugabinga has joined #ocaml
decentpenguin has joined #ocaml
SpiceGuid has quit [Ping timeout: 268 seconds]
status402_ has quit [Quit: status402_]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
ggole has quit [Quit: Leaving]
nullifidian has quit [Remote host closed the connection]
freyr69 has quit [Remote host closed the connection]
<companion_cube> oops, didn't mean to capslock
nc8 has quit [Quit: Page closed]
jbrown has quit [Ping timeout: 252 seconds]
<Drup> how is that any different than the `with` idiom ?
<companion_cube> it doesn't increase indentation, I guess
<companion_cube> (also it uses the object mechanism, with the common interface)
<companion_cube> IDisposable
ygrek has quit [Ping timeout: 250 seconds]
jao has joined #ocaml
SpiceGuid has joined #ocaml
bartholin has joined #ocaml
Haudegen has quit [Ping timeout: 272 seconds]
bartholin has quit [Ping timeout: 240 seconds]
orbifx has quit [Quit: WeeChat 2.3]
bartholin has joined #ocaml
ollehar has quit [Ping timeout: 268 seconds]
themsay has joined #ocaml
Haudegen has joined #ocaml
orbifx has joined #ocaml
jaar has quit [Ping timeout: 240 seconds]
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.46/20161213183751]]
Haudegen has quit [Ping timeout: 272 seconds]
jao has quit [Ping timeout: 272 seconds]
<orbifx> Anyone using openbsd?
Serpent7776 has joined #ocaml
jao has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
<Leonidas> UDisposable?
q9929t has joined #ocaml
TheLemonMan has joined #ocaml
<q9929t> should I learn Ocaml or Haskell?
<companion_cube> yes
<q9929t> yes what? Which will make the other easier to learn?
<companion_cube> honestly both are good
<q9929t> I couldn't agree more. But I guess both has steep learning curve. So I was thinking if one could help learn other better!
<companion_cube> hmm Ocaml is easier as a transition to Haskell, I think
<companion_cube> Haskell is more different from mainstream languages than OCaml is, so the gap is wider
<q9929t> Cool. I was already 10 chapters into "OCaml from the very beginning".
<Drup> also, haskell is probably much easier to get into if you are already familiar with static typing and functional programming, which OCaml will teach you
<Leonidas> q9929t: you should also learn Idris
<companion_cube> woah there, slow down :D
<Drup> Leonidas: why would you do that to him ?
<Leonidas> I think learning Haskell and OCaml is about the same ballpark of difficulty. OCaml might be a bit easier, but mostly it's like asking whether Python or Ruby is easier to learn
<Leonidas> companion_cube: hey, I haven't even talked about ATS2 yet :p
<companion_cube> I don't want to touch this
<companion_cube> I think ATS is possibly the ugliest language I've ever set eyes on
<q9929t> Leonidas: I have planned to learn a language a year. So, I'll look into Idris.
<Leonidas> q9929t: have you seen the 7 languages in 7 weeks books? They are a lot of fun.
<companion_cube> yeah well wait until you know OCaml and Haskell before looking at Idris, I'd say
<Drup> It's a bit like saying to someone "nice, you know how to use this screwdriver, let's now look at the drop-forge" =')
<Leonidas> companion_cube: but everything I hear about it sounds like a more powerful Rust :-)
<companion_cube> hu, closer to a more powerful haskell I'd say (but strict)
<Leonidas> with less need of unsafe bits
<Drup> Leonidas: you have to be able to differenciate between marketing and reality, when it comes to research-grade programing languages
<companion_cube> it's definitely not looking like rust :D
<Leonidas> Drup: are we talking about OCaml or ATS? *ducks*
<Drup> ATS
<Drup> ATS 1 was not even memory safey, so .. :/
<companion_cube> but it was fast, right? :p
<Drup> Well, it was fast on the toy bench, but nobody wrote anything in it, so ...
<Drup> Like they say, no users, no problems
<Leonidas> Yeah, that's a point.
<Leonidas> That said it depends on your reasoning why you're learning a language
<q9929t> Leonidas: I just found it. Will look into it.
<Drup> Leonidas: regardless, you should learn languages that are "the nicest" in their category
<companion_cube> 100% this
<Leonidas> I was learning Factor and I think I haven't had this much fun in learning a language, ever.
<Drup> if you want to learn dependent types, yeah, Idris is nice
<Drup> ATS isn't.
<companion_cube> also, ATS' syntax is like someone smoke cracks while reading C with an eye, SML with the other eye
<Drup> companion_cube: so like Rust ? :D
<companion_cube> too bad because the low level aspects are really interesting (to me)
<companion_cube> Drup: uh. well rust is the best you can achieve if you're trying to mix C++ and OCaml, I suppose
<companion_cube> I like most of their choices
<Leonidas> {}{}{}{}{}
jbrown has joined #ocaml
<companion_cube> Leonidas: that's actually nice
<companion_cube> in OCaml I do the same with () :/
<Leonidas> You might enjoy reasonml
<companion_cube> I know, but they have … dubious choices for many other things
<companion_cube> (like record's `with` syntax)
<Leonidas> I hate the way ocamlformat formats ( ) though
<Leonidas> it is just weird and arbitrary
<Drup> many people hate many choices about ocamlformat
<Drup> I don't understand why they stick to it
<companion_cube> united in hate!
<Drup> it's like they want their software to fail
<Leonidas> oh. I thought why people stick to ocamlformat. That'd be an easy answer.
<companion_cube> there's only one good way to format ifs, and it's mine 😇
<Leonidas> Drup: yes, I feel the same. Step 1: Impose a style noone in the wild uses Step 2: There are no more steps.
<companion_cube> Step 2: go to step 1
<Leonidas> companion_cube: yes, for that reason I don't use if at all
<Leonidas> can't figure out how to make it look not completely terrible
q9929t has quit [Quit: q9929t]
kakadu_ has joined #ocaml
<cemerick> it seems like reason would be an unvarnished good if/when the packaging and distribution stories are unified
<cemerick> i.e. via esy or whatever
<Leonidas> can't even install esy without npm :(
<cemerick> I have no problems with this 🤷
<cemerick> I also have a hard nodejs dependency, so oh well
<Leonidas> It just shows me where their priorities are, and this does not inspire trust
<Leonidas> also noone in the ocaml community seems to be using it. A shame because some ideas sound good.
doesntgolf has joined #ocaml
q9929t has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
q9929t has quit [Quit: q9929t]
<cemerick> what should their priorities be?
decentpenguin has quit [Quit: WeeChat 2.3]
<Leonidas> who am I to tell people what their priorities should be
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
<cemerick> I think it's okay to say along the lines of "if I were working in that area, I'd do x,y,z"
iovec has quit [Quit: Connection closed for inactivity]
<cemerick> at least, that's how I usually interpret such things
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
jao has joined #ocaml
Haudegen has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
Haudegen has joined #ocaml
<Leonidas> well, if I were to launch an improved package manager and wanted to gain buy-in from ocaml people I would probably start by either making it installable with standard tools that everyone already has, like the usual curl/bash thing or make it installable with the prevailing package manager in said community
<Leonidas> then I would probably also explain in detail why my package manager is better than the established one and have a way of using the existing packages of that package manager (if possible) or some way to translate these packages into my system
<Leonidas> it would also be nice to state why improving the existing one is not feasible
<Armael> :)
Serpent7776 has quit [Quit: leaving]
<companion_cube> you should tell them :p
<Leonidas> companion_cube: they told me to look at the source and submit a PR to make it independent from npm, but first I would need to care enough about it to consider using it, let alone contribute to it
<Leonidas> I only have this much motivation and granted, this has not caught me in a great mood
<Leonidas> It also is not annouced at all in the ocaml discuss, https://discuss.ocaml.org/search?q=esy so it is very hard to stumble upon it by chance
<Armael> isn't it because the target public for esy isn't ocaml programmers, but js programmers transitionning to reason/bs?
<Armael> hence the fact that esy reproduces the npm workflow that they know
<Armael> which is also why they don't need justify that it improves opam or whatever, it just matches the habits of its target audience and opam doesn't
<Leonidas> yes, that is well possible. But I think it is a shame to split the community
<companion_cube> they're very proud of esy and think OCaml programmers should use it too, Armael
<Leonidas> I mean, they do mention it works for ocaml: https://esy.sh/docs/en/what-why.html
<Armael> Leonidas: yes, I think too
<Leonidas> And the https://esy.sh/docs/en/what-why.html#for-opam-https-opamocamlorg-users section mentions some very reasonable points
<companion_cube> I think they plan to remove the hard dep on npm… at some point
<Leonidas> to me at the moment it seems like OCaml users are second priority, it is more geared towards ReasonML/NPM/Node.
<Armael> well yeah that's probably true
<Leonidas> I was told it is only used for installation
kvda has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
emersion has joined #ocaml
Haudegen has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cemerick> is "independent from npm" actually a feature?
<cemerick> I presume some nontrivial section of OCaml programmers do use/make javascript/web things, so making that easier seems good.
<companion_cube> maybe a non trivial section of reasonML users
<companion_cube> but "normal" OCaml programmers don't typically do web stuff, afaik
<companion_cube> (or they do crazy jsoo + ocsigen stuff)
<cemerick> I mean web stuff, using anything. Insofar as it's easier to use/reach web things with OCaml, maybe that means OCaml being used more in general.
kvda has joined #ocaml
jao has quit [Remote host closed the connection]
<companion_cube> if it's only used for web stuff, using a disjoint set of libraries, I don't really care
jao has joined #ocaml
asymptotically has quit [Ping timeout: 256 seconds]
moolc has joined #ocaml
AnAverageHuman has joined #ocaml
rom1504 is now known as get-title[bot]
MadcapJake has quit [Ping timeout: 246 seconds]
get-title[bot] is now known as rom1504
ohcamel has joined #ocaml
nullifidian has joined #ocaml
ohcamel has quit [Ping timeout: 256 seconds]
silver_ has joined #ocaml
Guest37220 has quit [Ping timeout: 240 seconds]
TC01 has quit [Ping timeout: 244 seconds]
silver has quit [Ping timeout: 246 seconds]
TC01 has joined #ocaml
TC01 has quit [Remote host closed the connection]
AnAverageHuman has quit [Ping timeout: 256 seconds]
TC01 has joined #ocaml
orbifx has quit [Quit: WeeChat 2.3]
AnAverageHuman has joined #ocaml
dedgrant has joined #ocaml
bartholin has quit [Remote host closed the connection]
TC01 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
TC01 has joined #ocaml