companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
wingsorc has quit [Remote host closed the connection]
dextaa has quit [Read error: Connection reset by peer]
<pgiarrusso> Does anybody understand why the opam dependency solver is so bad? The solutions it finds are always technically correct, yet so wrong
dextaa has joined #ocaml
<pgiarrusso> my best experience was when a benchmarking loop of `opam install coq-stdpp; opam uninstall coq-stdpp` kept flipping some other library (either `num` or `zarith`) between two versions. The timings being off was not the most surprising thing…
wingsorc has joined #ocaml
<pgiarrusso> I noticed hints that they are now using a MaxSAT solver, and you can set optimization metrics, but I have still seen strange behaviors that did not make much sense.
<pgiarrusso> some of the responses in https://github.com/ocaml/opam/issues/5035 suggest opam's explanations for actions aren't even expected to be correct:-|
waleee has quit [Ping timeout: 260 seconds]
Haudegen has quit [Ping timeout: 256 seconds]
bobo_ has joined #ocaml
spip has quit [Ping timeout: 276 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
motherfsck has quit [Ping timeout: 272 seconds]
zebrag has joined #ocaml
xd1le has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
williewillus0 is now known as williewillus
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<d_bot> <sim642> Did you solve the constraint problem by hand or how are you so sure that the dependency version didn't have to change?
<d_bot> <sim642> I guess you could also try making that dependency invariant and see if opam complains about a conflict then
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jtm has quit [Read error: Connection reset by peer]
jtm has joined #ocaml
sagax has quit [Remote host closed the connection]
mbuf has joined #ocaml
Techcable has quit [Remote host closed the connection]
sagax has joined #ocaml
Techcable has joined #ocaml
mbuf has quit [Ping timeout: 240 seconds]
mbuf has joined #ocaml
mbuf has quit [Ping timeout: 240 seconds]
mbuf has joined #ocaml
Tuplanolla has joined #ocaml
mro has joined #ocaml
mro has quit [Quit: Leaving...]
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #ocaml
bartholin has joined #ocaml
Haudegen has joined #ocaml
wingsorc has quit [Remote host closed the connection]
chrisz has quit [Ping timeout: 276 seconds]
wingsorc has joined #ocaml
wingsorc has quit [Client Quit]
wingsorc has joined #ocaml
chrisz has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
waleee has joined #ocaml
azimut has joined #ocaml
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
bartholin has quit [Ping timeout: 240 seconds]
spip has joined #ocaml
bartholin has joined #ocaml
bobo_ has quit [Ping timeout: 244 seconds]
Serpent7776 has quit [Quit: leaving]
mro has joined #ocaml
waleee has quit [Ping timeout: 244 seconds]
bastienleonard has joined #ocaml
xgqt has quit [Ping timeout: 244 seconds]
xgqt has joined #ocaml
mro has quit [Remote host closed the connection]
Haudegen has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
mro has joined #ocaml
Haudegen has joined #ocaml
bartholin has quit [Ping timeout: 272 seconds]
bartholin has joined #ocaml
bastienleonard has quit [Ping timeout: 240 seconds]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
azimut_ has quit [Ping timeout: 268 seconds]
mro has quit [Remote host closed the connection]
bastienleonard has joined #ocaml
deadmarshal has quit [Quit: IRCNow and Forever!]
deadmarshal has joined #ocaml
mbuf has quit [Quit: Leaving]
bartholin has quit [Ping timeout: 240 seconds]
jpds1 has quit [Ping timeout: 268 seconds]
mro has joined #ocaml
jpds1 has joined #ocaml
xd1le has quit [Quit: xd1le]
<d_bot> <Emile Trotignon> But you can do `Stack.(push 1 (create ()))` which may be nicer and you still avoid conflict
<d_bot> <Stalker> ah thanks
mro has quit [Remote host closed the connection]
bastienleonard has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
<d_bot> <Pluton> Is ocaml good for making programming languages
bastienleonard has joined #ocaml
mro has joined #ocaml
<d_bot> <Et7f3 (@me on reply)> I would say yes because pattern matching with good typechecking help a lot
<d_bot> <Pluton> Is it like worth learning it in 2022
<d_bot> <Et7f3 (@me on reply)> do you know other languages ?
<d_bot> <Pluton> Python and basic C++
<d_bot> <Pluton> And ive tried stuff like Ruby , Java , C#
<d_bot> <Et7f3 (@me on reply)> python begin to have pattern matching but I find it weird. gcc use c++ so it is doable but use recent idioms or prepare to debug memory issues. Java and ruby can't tell. If you want to design a language OCaml has concept not in theses languages so it could be a good inspiration
<d_bot> <Pluton> So OCaml would be an inspiration. But like whats the reason you would make your next project in OCaml rather than C++ or C
<d_bot> <Et7f3 (@me on reply)> To be totally fair. Try to do a toy language like int + int and string + string in those language with same tool (use parser generator for both or for none)
<d_bot> <Pluton> To see which one is easier/better for that
azimut has joined #ocaml
<d_bot> <Et7f3 (@me on reply)> Yes you will see quirks of each language
<d_bot> <Et7f3 (@me on reply)> With c++20 it begin to be a good challenger so I don't know
<d_bot> <Pluton> Ok thanks alot.
riverdc has quit [Ping timeout: 240 seconds]
riverdc has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
Serpent7776 has joined #ocaml
waleee has joined #ocaml
rgrinberg has joined #ocaml
<dh`> anyone inexperienced enough that they still consider learning another language a significant task will almost certainly benefit from learning more languages, whether or not those languages are "useful"
<d_bot> <ArJank> Learning ocaml is def a significant task alright :triggered_ocaml:
<dh`> eh. once you know how to program, any language is just new syntax and a new standard library to get familiar with
<dh`> if you haven't got that level of facility yet, more exposure to the way different languages do things is a good thing
mro has quit [Read error: Connection reset by peer]
mro_ has joined #ocaml
<d_bot> <ArJank> yey
<d_bot> <ArJank> Why are u texting through a bot
<d_bot> <NULL> Read the description of the channel
<d_bot> <ArJank> woah
<CalimeroTeknik> dh`, or maybe once you know a programming concept, using it in any language is just a formality, but if it's one you don't know of, you need to learn it first
<CalimeroTeknik> ArJank, from our perspective *you* are talking through a bot
<d_bot> <NULL> There's also the unlearning part when you get to a language which is not OCaml
raskol has joined #ocaml
<CalimeroTeknik> is there? I don't know, I have used many languages, not among which OCaml
<d_bot> <NULL> Having to work without sum types is difficult when you're used to it
<d_bot> <NULL> them*
<CalimeroTeknik> thankfully, those are starting to become available everywhere
bartholin has quit [Quit: Leaving]
<d_bot> <NULL> Eh, I strongly dislike Scala's version of sum types even if it is supposed to fully support functional programming
<CalimeroTeknik> what is the problem, no tagged unions?
<CalimeroTeknik> I doubt that
<d_bot> <NULL> You declare constructors as subclasses of a class
<d_bot> <NULL> Tagged unions is what I was calling sum types
<CalimeroTeknik> eh, it's not that bad
<dh`> calimeroteknik: yes, except that "knowing how to program" includes more than just knowing some programming concepts, it's also about knowing how to string them together effectively
<dh`> anyway, sum types are extremely useful for writing compilers and interpreters and not so much elsewhere
<dh`> C has gotten away with unions for forty years not because C programmers are masochists but because the issue doesn't often come up in other contexts
<d_bot> <NULL> I prefer having constants be constructors when possible instead of ints hidden behind a name
<d_bot> <Pluton> Is this bot made in OCaml?
<d_bot> <NULL> (Discord answers don't make it through the bridge)
<d_bot> <Pluton> Decoded that means. That the guy cant see my replies?
<d_bot> <Pluton> That aint even a bot. Thats the webhook right?
<d_bot> <NULL> That they won't see which message you were replying to (including who sent that message and that it was a response)
jonasbits has quit [Ping timeout: 276 seconds]
<d_bot> <Pluton> @dh`#0000 is this a webhook
<d_bot> <NULL> What do you mean by webhook ? This is a bridge to IRC
<d_bot> <Pluton> What is IRC?
bartholin has joined #ocaml
raskol has quit [Ping timeout: 256 seconds]
<d_bot> <leviroth> The bridge is not in ocaml as far as I know. It's some open-source thing; can't remember the name.
<d_bot> <Pluton> Oh
<d_bot> <Pluton> Bc sending msg through discord webhook is like 5 lines of code in python
<d_bot> <Pluton> How much would it be in OCaml?
<d_bot> <leviroth> About the same
<d_bot> <Pluton> As far as ive seen OCaml code it seems easy to type
jonasbits has joined #ocaml
<d_bot> <leviroth> IRC is an older, less centralized chat protocol.
<d_bot> <Pluton> Oh so using webhooks and whatever IRC uses it connects the 2 general chats ig
<d_bot> <NULL> That's what a bridge is, yes
<d_bot> <Pluton> How does it look from their side?
<d_bot> <Pluton> I mean we have webhooks what do they have to get msgs
<d_bot> <NULL> What do you mean by "webhook" exactly ?
<d_bot> <Pluton> The thing they use to send the msgs
<d_bot> <Pluton> Its called a webhook
<d_bot> <NULL> IRC surely has a similar API to receive and send messages
<d_bot> <NULL> AFAIU this bot isn't a webhook since there's one bot user per IRC user, it's just what Discord calls a bot I guess
<d_bot> <NULL> The Feeds channels are webhooks however
<dh`> irc is a protocol, not an API
mro_ has quit [Quit: Leaving...]
bartholin has quit [Quit: Leaving]
<d_bot> <Pluton> No thats exactly a webhook
<d_bot> <Pluton> @dh`#0000 he is a we hook
<d_bot> <Pluton> The bot that makes the webhook is a bot
<d_bot> <NULL> That's not how you mention someone in IRC
<d_bot> <Pluton> I didnt want to mention him i wanted to mention the webhook but its not a user so i cant
<d_bot> <Pluton> It makes more sense that there is 1 webhook per 1 IRC user
<d_bot> <Pluton> Than 1 bot
<d_bot> <leviroth> I don't think the bridge is implemented through Discord webhooks
<d_bot> <Pluton> Then how would it be implemented?
<d_bot> <Pluton> Yes ive read tgat
<d_bot> <Pluton> Ive made some demo libraries myself
<d_bot> <Pluton> And those arent bots. They are either webhooks or something ive never heard of existed in discord. Probably webhooks tho
<d_bot> <leviroth> There is clearly lots of stuff in those docs besides webhooks
<d_bot> <leviroth> You can see that there's a separate "Webhooks" page which only encompasses a tiny part of the API surface area
<d_bot> <Pluton> So what are they then?
<d_bot> <NULL> What's the problem with calling the rest "bots" ?
<d_bot> <Pluton> I mean those accounts arent bots
<d_bot> <leviroth> What accounts are you talking about?
<d_bot> <NULL> To Discord, they are messages sent by a bot
<d_bot> <Pluton> @dh`#0000 , @CalimeroTeknik#0000
<d_bot> <Pluton> By a webhook tho
<d_bot> <NULL> Why must it be a webhook ?
<d_bot> <Pluton> Because it has no account
<d_bot> <Pluton> It is connected to this channel only
<d_bot> <NULL> And the docs show you there are more than one way to send a message without a Discord account
<d_bot> <Pluton> Yes through a bot and a webhook. Is there any 3rd?
<d_bot> <NULL> A bot then
<d_bot> <leviroth> I think we're using matterbridge; you can see how the Discord integration is set up here: https://github.com/42wim/matterbridge/wiki/Discord-bot-setup
<d_bot> <Pluton> They said it uses webhook in a FAQ
<d_bot> <leviroth> Yeah, I think they use webhooks for some features. I do not think they are using webhooks for generally sending and receiving messages. (Can you even use webhooks to receive messages?)
<d_bot> <Pluton> To receive message. No
<dh`> UTSL
<d_bot> <Pluton> But to send yes
<d_bot> <Pluton> Its very simple to send messages through webhooks as you only need to send a post request to 1 website
<d_bot> <Pluton> And the reason im guessing they use webhooks is because bots can easily create them and they can customize the name of a webhook and profile picture.
<d_bot> <Pluton> This is how easy it is to send a msg through a webhook (in python)
<d_bot> <Pluton> ```py
<d_bot> <Pluton> import requests
<d_bot> <Pluton> requests.post(webhook_url , data = data)
<d_bot> <Pluton> ```
<d_bot> <Pluton> I wonder how it would look in OCaml
<d_bot> <leviroth> Sure but once someone has implemented the websocket part of the api in your language (in this case, go) and you're already using websockets anyway, it doesn't really matter how simple it would be to use a webhok. Because whatever additional complexity there is in the websocket is already handled for you.
<d_bot> <Pluton> I mean it seems like matterbridge has its own little wrapper
<d_bot> <Pluton> Around the discord api. Thats very cool
<d_bot> <leviroth> It would look something like:
<d_bot> <leviroth>
<d_bot> <leviroth> ```ocaml
<d_bot> <leviroth> Cohttp_async.Client.post ~body:(Body.of_string (Jsonaf.to_string (`Object ["contents", data]))) webhook_uri
<d_bot> <leviroth> ```
<d_bot> <Pluton> Is the indentation optional or is it a thing in OCaml?
<d_bot> <NULL> Whitespace is not significant in OCaml
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
<d_bot> <leviroth> Oh and I probably omitted some necessary header to say that the body is json
<d_bot> <leviroth> because for some reason it isn't enough to just parse json out of your json-accepting endpoint 🤷‍♂️
Haudegen has joined #ocaml
<d_bot> <Pluton> That looks kinda weird ngl. Nothing ive ever seen in other languages before
<d_bot> <NULL> OCaml looks different since application is `f x` instead of `f(x)`, but that's the biggest difference by far
<d_bot> <hockletock> it looks a lot like your example to me?
<d_bot> <hockletock> you just happen to have data in a format .post() accepts
<d_bot> <Pluton> ```ocaml
<d_bot> <Pluton> ~body:(Body.of_string (Jsonaf.to_string (\`Object ["contents", data])))
<d_bot> <Pluton> ```
<d_bot> <Pluton> I mean this part looks confusing ngl
<d_bot> <leviroth> Things are bound to look strange if you're unfamiliar with them. I agree with others that the most obvious differences are 1) lack of parens and 2) there are more explicit conversions because I'm not using a giant kitchen-sink library like `requests`
<d_bot> <leviroth> Oh, and there's no map/dict/object literal syntax, so you have to spell out the JSON using more basic language constructs.
<d_bot> <leviroth> I think the only reason it looks confusing is because `requests` takes the JSON that you give it and does most of that for you
<d_bot> <Pluton> So this creates a json like object and strigifies it
<d_bot> <leviroth> If you were writing the python version by using the lower-level urllib2 module it would probably look similar
<d_bot> <leviroth> Yes, with the additional step that it wraps that string in a type that represents specifically strings that are the bodies of HTTP requests
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot> <Pluton> Whats the best resource to learn OCaml i see there arent alot
<d_bot> <hockletock> I've received excellent help in discord 🙂
<d_bot> <leviroth> I've generally heard good things about "OCaml from the very beginning" (which I think was recently made freely available online) and the Cornell CS course that's taught in OCaml: https://cs3110.github.io/textbook/cover.html
<d_bot> <leviroth> And, yes, being able to actually talk to people is immensely valuable.
wingsorc has quit [Remote host closed the connection]
zebrag has joined #ocaml
wingsorc has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
<d_bot> <Pluton> Im following that rn but why did he do
<d_bot> <Pluton> ```
<d_bot> <Pluton> let _ = print_endline "Hello world!"
<d_bot> <Pluton> ```
<d_bot> <Pluton> Instead of just
<d_bot> <Pluton> ```
<d_bot> <Pluton> print_endline "Hello World!"
<d_bot> <Pluton> ```
<d_bot> <Pluton> It seems like `let _ =` is useless
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 268 seconds]
<d_bot> <NULL> At toplevel / module-level, you either chain definitions or you write expressions separated by `;;`. The latter is often considered uglier (at least by me) and is preferred for REPLs where the return values are used in some way. Therefore, you often group effectful expressions in a "dummy" definition like this. I would have written `let () = ...` to ensure the return value is unit
<d_bot> <NULL> As a beginner, the "uglier" choice is still fine
<d_bot> <Pluton> Hmm ok so its some advanced thing ig
raskol has joined #ocaml
raskol has quit [Ping timeout: 240 seconds]