companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
remexre has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
<copy> the discord bot should probably put a limit on the size of messages
rock64_ has quit [Ping timeout: 256 seconds]
amiloradovsky has quit [Ping timeout: 240 seconds]
rock64 has joined #ocaml
robmyers has quit [Ping timeout: 240 seconds]
robmyers has joined #ocaml
sgnb` has joined #ocaml
Putonlalla has quit [Ping timeout: 258 seconds]
d_bot_ has joined #ocaml
Putonlalla has joined #ocaml
beaky_ has joined #ocaml
Haudegen has quit [Ping timeout: 260 seconds]
heredoc_ has joined #ocaml
d_bot has quit [*.net *.split]
heredoc has quit [*.net *.split]
rom1504 has quit [*.net *.split]
beaky has quit [*.net *.split]
rom1504 has joined #ocaml
remexre has quit [Quit: WeeChat 2.9]
laokz has joined #ocaml
mfp has quit [Ping timeout: 246 seconds]
remexre has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
laokz has quit [Ping timeout: 256 seconds]
_whitelogger has joined #ocaml
narimiran has joined #ocaml
mbuf has joined #ocaml
mmohammadi9812 has joined #ocaml
mmohammadi98129 has joined #ocaml
mmohammadi9812 has quit [Ping timeout: 256 seconds]
mmohammadi98129 is now known as mmohammadi9812
mbuf has quit [Read error: Connection reset by peer]
mmohammadi9812 has quit [Ping timeout: 258 seconds]
beaky_ is now known as beaky
vicfred has quit [Remote host closed the connection]
vicfred has joined #ocaml
alehander92 has quit [Ping timeout: 258 seconds]
mrallen1 has quit [Ping timeout: 258 seconds]
<d_bot_> <ShalokShalom> Hi! This bot is connected to the IRC, yes?
alehander92 has joined #ocaml
mrallen1 has joined #ocaml
Haudegen has joined #ocaml
<d_bot_> <dj charlie> Pepega yeah
<d_bot_> <ShalokShalom> @ostera I like your Caramel project and a friend of mine will love it absolutely. I did allow myself to send it to him, that is star-spangled awesome ✨
Tuplanolla has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
mmohammadi98129 has joined #ocaml
mmohammadi98129 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
reynir has quit [Ping timeout: 260 seconds]
mmohammadi98129 has joined #ocaml
reynir has joined #ocaml
narimiran has quit [Ping timeout: 246 seconds]
reynir has quit [Ping timeout: 260 seconds]
laokz has joined #ocaml
reynir has joined #ocaml
mmohammadi98129 has quit [Quit: Ping timeout (120 seconds)]
mmohammadi98129 has joined #ocaml
reynir has quit [Ping timeout: 260 seconds]
reynir has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
dhil has joined #ocaml
amiloradovsky has joined #ocaml
mmohammadi98129 has quit [Ping timeout: 256 seconds]
mmohammadi98129 has joined #ocaml
jnavila has joined #ocaml
mfp has joined #ocaml
waleee-cl has joined #ocaml
mmohammadi98129 has quit [Ping timeout: 240 seconds]
bitonic has quit [Read error: Connection reset by peer]
bitonic has joined #ocaml
cemerick has quit [Ping timeout: 260 seconds]
SrPx has quit [Read error: Connection reset by peer]
cemerick has joined #ocaml
SrPx has joined #ocaml
mmohammadi98129 has joined #ocaml
laokz has quit [Ping timeout: 240 seconds]
laokz has joined #ocaml
caasih has quit [Ping timeout: 272 seconds]
caasih has joined #ocaml
banjiewen has quit [Ping timeout: 272 seconds]
banjiewen has joined #ocaml
dhil has quit [Ping timeout: 256 seconds]
metadave has quit [Ping timeout: 256 seconds]
amiloradovsky has quit [Ping timeout: 240 seconds]
metadave has joined #ocaml
<d_bot_> <mseri> Seems that lots of people are liking it. It has already reached the top of hacker news and lobster
laokz has quit [Ping timeout: 260 seconds]
laokz has joined #ocaml
<d_bot_> <ostera> what
mmohammadi98129 has quit [Ping timeout: 246 seconds]
dhil has joined #ocaml
laokz has quit [Quit: Leaving]
<d_bot_> <mseri> Yeah, have a look https://news.ycombinator.com/item?id=24605277
<d_bot_> <mseri> They are shown as second and fifth in my respective front pages
ggole has joined #ocaml
tane has joined #ocaml
minwuek has quit []
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
narimiran has joined #ocaml
cloveistaken has joined #ocaml
reynir has quit [Ping timeout: 256 seconds]
reynir has joined #ocaml
<d_bot_> <ShalokShalom> On hackernews, it was first a couple of hours ago
<d_bot_> <qubit1> > Yeah, have a look https://news.ycombinator.com/item?id=24605277
<d_bot_> <qubit1> @mseri Funny how people are still arguing about the benefits of static strong type systems...
<d_bot_> <ShalokShalom> @ostera Do you know this?
<d_bot_> <ShalokShalom> https://github.com/kjnilsson/fez
RalfJ has quit [Ping timeout: 260 seconds]
RalfJ has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
<cloveistaken> Howdy
<cloveistaken> I'm having a class about Ocaml this semester
<cloveistaken> I have been doing some exercises but I'm looking for more to practice
<cloveistaken> Any suggestions about books for beginners or such ? Just exercises is fine too
<cloveistaken> I couldn't find any FAQ for this sort of things
<Armael> I've heard that both http://www.cs.cornell.edu/courses/cs3110/2019sp/textbook/ and "OCaml from the very beginning" by John Whitington are good beginner books
<cloveistaken> Thanks
<cloveistaken> Looks very interesting, I'll take a look
<d_bot_> <ostera> @ShalokShalom i was aware of fez 🙂 i've never set up f# so i never really tried it -- will definitely browse its sources andd see how it dealt with some things! (uncurrying, typed send, etc)
<companion_cube> @ostera how realistic is it to interoperate caramel with OTP, not just beam?
<d_bot_> <ostera> rudimentary support is there, you just need to write some ffi's
<d_bot_> <ostera> here's an example
dhil has quit [Ping timeout: 240 seconds]
<d_bot_> <ostera> but of course that isn't very pretty because the ffi's aren't very safe
<d_bot_> <ostera> but if I get support for functors, I can imagine a thin layer that enforces type-safety on top of the lower level ffi's
<d_bot_> <ostera> `include Gen_server.Make(struct ... end)`
<companion_cube> what's the type of `Gen_server.call`?
<d_bot_> <ostera> `external call : 'a Erlang.process -> 'a -> 'b = ""`
<d_bot_> <ostera> (again, the ffi is too broad)
<companion_cube> ahah ok
<companion_cube> could one have typed actors?
<companion_cube> 'a pid
<d_bot_> <ostera> yes
<companion_cube> and an upcast to a any_pid ofc
<d_bot_> <ostera> the problem isn't the `call` or the `send`, really
<d_bot_> <ostera> the problem is getting a hold of a `'a pid` that is meaningfully typed
<d_bot_> <ostera> `external send : 'm t -> 'm -> unit = ""` does the trick for constraining the messages you're sending
<companion_cube> my impression (I know little about erlang really) is that one uses OTP everywhere, and messages quite rarely
<companion_cube> is that the case?
<d_bot_> <ostera> well, OTP is just libraries that abstract common message passing patterns for you
<d_bot_> <ostera> e.g, any actor can be a "server", if it constantly loops and when it receives a message updates its "internal state"
<companion_cube> but like, gen_server is basically an object
<companion_cube> so I imagine a lot of code is going to use that + supervision stuff?
<d_bot_> <ostera> gen_server abstracts over all of that so you get both sync and async "calls" to the process
<d_bot_> <ostera> yes, supervision trees are also part of otp, albeit orthogonal to gen_servers
<d_bot_> <ostera> supervision trees are obtained through process monitors and links (e.g, you'll receive a message if an actor linked to you dies, then you can choose to bring it back up again)
<companion_cube> and child_spec?
<companion_cube> anyway, I wonder if the best abstraction for that in OCaml would be… objects?
<d_bot_> <ostera> possibly!
<companion_cube> with a #pid method perhaps
<d_bot_> <ostera> one way of getting a meaningfully typed `'a pid` is to figure out what messages are being listened on, that's your `'a` , in that typed_reply.ml this is happening with a little runtime overhead: https://github.com/AbstractMachinesLab/caramel/blob/main/examples/processes/process.ml#L11-L17
<d_bot_> <ostera> (which btw, is the same mechanism I've used when reading erlang sources into an ocaml typedtree to figure out what the message type was)
<d_bot_> <ostera> @companion_cube yeah, a lt of code builds on top of otp but not all of it does -- message passing is slower than single-process work, so a lot of erlang code runs on single processes that call many libraries
<d_bot_> <ostera> i.e, not everything is a process
<companion_cube> interesting
<companion_cube> but on a single process it's probably easy to emulate, since it's such a small pure language :)
<d_bot_> <ostera> exactly
<companion_cube> what do you think of Gleam, btw?
<d_bot_> <ostera> i think it looks great!
<d_bot_> <ostera> big inspiration
<d_bot_> <ostera> its clearly drawing from Rust, which I also enjoy working with
<d_bot_> <ostera> (i even have a fork where I allow single-file compilation 😛 mostly because I was copying `dune` for the beam and being able to compile single files was key to achieving incremental builds)
<d_bot_> <ostera> but its hard to beat the ocaml compiler, so if I can enable the many millions of human hours invested in it, even a subset of it, to run on the beam -- that seemed like a no brainer to me
<d_bot_> <ShalokShalom> https://gluon-lang.org/
<d_bot_> <ShalokShalom> ML on Rust, like Lua on C++:
<d_bot_> <ShalokShalom> Embedding, calling its functions and super clean 😇
<d_bot_> <ostera> yeah, ffi's are the devil
dhil has joined #ocaml
Anarchos has joined #ocaml
<d_bot_> <ShalokShalom> Its super underrated 🙄
<d_bot_> <ShalokShalom> Rust dev's somehow think, they can do all with Rust
<d_bot_> <ShalokShalom> Including scripting and they see no sense in such one language, sadly.
hnOsmium0001 has joined #ocaml
osa1 has joined #ocaml
mmohammadi98129 has joined #ocaml
reynir has quit [Ping timeout: 260 seconds]
reynir has joined #ocaml
rig0rmortis has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot_> <Kakadu> I watched Nottui video from ICFP today and now I'm nostalgizing about Borland Turbo Vision...
muskan has joined #ocaml
muskan has quit [Remote host closed the connection]
_whitelogger has joined #ocaml
rig0rmortis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
osa1 has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 256 seconds]
rwmjones is now known as rwmjones-hol
reynir has quit [Ping timeout: 256 seconds]
dhil has joined #ocaml
reynir has joined #ocaml
rockethead has joined #ocaml
reynir has quit [Ping timeout: 256 seconds]
narimiran has quit [Ping timeout: 265 seconds]
reynir has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
<d_bot_> <beheddard> is anyone aware if one can add custom infix operators to those considered by ocp-indent?
<d_bot_> <beheddard> from looking through the configuration options in the manpage it seems like no? Not exactly sure what kind of arguments are expected by the --syntax, but probably more meaty language extensions rather than just say a `( >> )` infix
ggole has quit [Quit: Leaving]
rockethead has quit [Ping timeout: 272 seconds]
<cloveistaken> Very quick question, I'm doing an exercise related to custom types. Is it possible to overload arithmetics operation + - * / for that types ?
<d_bot_> <beheddard> ```
<d_bot_> <beheddard> module Foo = struct
<d_bot_> <beheddard> type t = Foo of int
<d_bot_> <beheddard> let ( + ) (Foo a) (Foo b) = Foo (a + b)
<d_bot_> <beheddard> end;;
<d_bot_> <beheddard> module Foo : sig type t = Foo of int val ( + ) : t -> t -> t end
<d_bot_> <beheddard>
<d_bot_> <beheddard> Foo.((Foo 10) + (Foo 5));;
<d_bot_> <beheddard> (* - : Foo.t = Foo.Foo 15 *)
<d_bot_> <beheddard> ```
<d_bot_> <beheddard> it shadows the operator, so you will want to be restrictive in how you open the module that includes the operators
_whitelogger has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
<cloveistaken> Oh I see
<cloveistaken> I never thought about writing it as a separated module
<cloveistaken> Wait but that mean I can do it normally right ?
<cloveistaken> REPL seems to agree
<d_bot_> <beheddard> "normally" as in not in a module?
<d_bot_> <beheddard> you can do it, but the arithmetic operator will be "shadowed" at the top-level
tane has quit [Quit: Leaving]
<d_bot_> <beheddard> try doing normal addition between ints after defining a `( + )` function like above
<cloveistaken> Oh wow
<cloveistaken> I thought it would behave like C
<cloveistaken> + int -> int and + foo -> foo are different
<cloveistaken> Is that why we have + and +.
<cloveistaken> ?
<d_bot_> <beheddard> yea there isn't overloading in ocaml
<d_bot_> <beheddard> yes
<cloveistaken> Why it's the case here ?
<cloveistaken> I mean design-wise
<cloveistaken> Does this make sense ?
<d_bot_> <beheddard> as far as I know, the designers wanted things to be more explicit. There are pros and cons as will everything
<d_bot_> <beheddard> you can know the types just from looking at the operators, but of course some of the convenience that comes along with legal overloading is lost
dhil has quit [Ping timeout: 264 seconds]
<cloveistaken> So what is a good practice here ?
<cloveistaken> Should I create Foo_{add,sub,...}
<cloveistaken> Or what are the alternatives ?
<d_bot_> <beheddard> as far as I know the example I provided above with a type module is an accepted practice
<cloveistaken> Why wouldn't it shadowed the original + ?
<cloveistaken> After open I mean
<d_bot_> <beheddard> it only shadows ( + ) in the context of the module
<d_bot_> <beheddard> if you `open Foo` + will be shadowed
<d_bot_> <beheddard> but you can do local opens like `let open Foo in` and `Foo.()`
<d_bot_> <beheddard> you see this strategy a lot with monadic operators like bind `>>=` and map `>>|`
<cloveistaken> I don't think I saw those operators before
<d_bot_> <beheddard> modules for monadic types will often define them, knowing that users will make use of local opens to utilize them. You don't want to globally open these things ever anyway, since they define so many functions with the same name
<d_bot_> <beheddard> you might some day, the point is that even though they aren't builtin operators like `+`, they are still quite common and people expect them to have a particular meaning
<cloveistaken> I get it
<d_bot_> <beheddard> containing them in a module that is not meant to be globally opened is accepted practice since then they won't shadow other stuff unexpectedly
<cloveistaken> Thanks a lot
<cloveistaken> Hope I would get used to the syntax and such soon
<d_bot_> <beheddard> no problem, good luck
<d_bot_> <undu> those modules are usually called Infix like https://ocsigen.org/lwt/5.2.0/api/Lwt.Infix
<d_bot_> <beheddard> true
<cloveistaken> What is the d_bot_ thingy btw ?
<cloveistaken> Some sort of a bridge ?
<Fardale> Bridge with the discord server
reynir has quit [Ping timeout: 260 seconds]
Tuplanolla has quit [Quit: Leaving.]
reynir has joined #ocaml
rig0rmortis has joined #ocaml
nullcone has quit []
nullcone has joined #ocaml
Haudegen has quit [Ping timeout: 264 seconds]
rig0rmortis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mmohammadi98129 has quit [Ping timeout: 258 seconds]