<discocaml>
<uberpyro181> Hasn't there been an annotation around for that for a while now?
<discocaml>
<uberpyro181> is TRMC automatic or something or is this more recent than i remember
Anarchos has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
alexherbo2 has joined #ocaml
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml>
<gooby_diatonic> I think he just dismissed it as irrelevant until now
alfiee has joined #ocaml
<discocaml>
<deepspacejohn> it was added to the compiler in 4.14 but the stdlib didn't start using it until after 5 or 5.1 I think.
alfiee has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 245 seconds]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
gzar has joined #ocaml
troydm has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 272 seconds]
alfiee has joined #ocaml
alexherbo2 has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
Guest4014 has joined #ocaml
Guest4014 has quit [Remote host closed the connection]
Juan has joined #ocaml
Juan is now known as Guest2503
Guest2503 has quit [Remote host closed the connection]
alexherbo2 has quit [Remote host closed the connection]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 260 seconds]
Serpent7776 has quit [Ping timeout: 260 seconds]
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 244 seconds]
fmira has quit [Remote host closed the connection]
fmira has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 244 seconds]
fmira has quit [Read error: Connection reset by peer]
fmira has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
shrewd has quit [Quit: shrewd]
rgrinberg has joined #ocaml
fmira has quit [Remote host closed the connection]
fmira has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 244 seconds]
infinity0 has quit [Ping timeout: 252 seconds]
infinity0 has joined #ocaml
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 252 seconds]
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
Serpent7776 has joined #ocaml
<dh`>
I am using 4.14 because (a) coq doesn't officially support 5 yet and (b) stdlib changes in Random mean that one project requires a flag day
<dh`>
neither of which is a stopper exactly but they create inertia
<discocaml>
<._null._> It's more like one feature of Rocq that few people use doesn't work in OCaml 5
alfiee has joined #ocaml
<dh`>
doesn't really matter what the issue is, just that it exists
<discocaml>
<barconstruction> Today I learned about the nostdlib and nopervasives compiler flags. It made me realize you could do
<discocaml>
<barconstruction> "Haskell in OCaml". Specifically what I mean by this is a guarantee that all IO operations are regulated through a monad. My idea is as follows: First create a library MyStdlib which is a shim over the original stdlib but with a more restrictive interface that doesn't expose IO stuff. Then develop all your code in library B which is all parametrized over an IO module exposing a monad interface. B exposes a single "main" lazy value at
alfiee has quit [Ping timeout: 244 seconds]
<discocaml>
<barconstruction> I don't know if flambda is sufficiently aggressive to remove the overhead of this stuff for typical IO operations.
<dh`>
why would you _want_ to do that?
<discocaml>
<Kali> i have thought about that before but never ended up doing it
<discocaml>
<Kali> alternatively only permitting io operations as effects
<discocaml>
<Kali> although the lack of effect information in types would make this idea less interesting
<discocaml>
<barconstruction> I am teaching a friend OCaml and I've been gradually introducing more "functional" concepts over the course of 3 months or so. He is comfortable with List.map and pattern matching so I wanted to demonstrate sophisticated usage of higher order functions. We implemented the option monad and I showed him how this lets you avoid uncaught exceptions without adding too much boilerplate. Next I had him implement his own Lazy.t using a variant
alfiee has joined #ocaml
<dh`>
sure, but that's an exercise
alfiee has quit [Ping timeout: 268 seconds]
<discocaml>
<barconstruction> I answered your question.
amirouche has joined #ocaml
<discocaml>
<uberpyro181> implementing the IO monad sounds sort of dry and hard to motivate
<discocaml>
<uberpyro181> I think the most important thing for newcomers to get used to is fold
<discocaml>
<uberpyro181> especially `List.fold_left`
<discocaml>
<uberpyro181> people from imperative paradigms have a reflex to reach for a `for` loop that is sort of difficult to break
rgrinberg has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<discocaml>
<uberpyro181> for loops with accumulators in general can be simulated with folds
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 248 seconds]
bartholin has quit [Quit: Leaving]
Serpent7776 has quit [Ping timeout: 272 seconds]
<discocaml>
<contificate> I'd hit them with things like zippers, persistent data structures, accumulating closures, CPS (which should've came before monads), etc.
alfiee has joined #ocaml
alfiee has quit [Ping timeout: 246 seconds]
deadmarshal_ has quit [Remote host closed the connection]
<discocaml>
<uberpyro181> hi
<discocaml>
<uberpyro181> yeah I think my university course focused on persistent data structures pretty hard early on, just to get used to mutable state
<discocaml>
<uberpyro181> the second assignment had a game where a bunch of functions were `stuff -> state -> state` to get used to immutable state, then after that was implementing okasaki trees
<discocaml>
<uberpyro181> the second or third assignment had a game where a bunch of functions were `stuff -> state -> state` to get used to immutable state, then after that was implementing okasaki trees
<discocaml>
<uberpyro181> the second or third assignment had us implementing a game where a bunch of functions were `stuff -> state -> state` to get used to immutable state, then after that was implementing okasaki trees
<dh`>
barconstruction: fair enough, I guess I meant something like "why would you want to do that for serious"
<dh`>
(especially since haskell is available for exercises)
<companion_cube>
Even if you want an IO monad, why would you ever make it lazy?
trillion_exabyte has quit [Ping timeout: 272 seconds]
trillion_exabyte has joined #ocaml
<discocaml>
<yawaramin> referential transparency
rgrinberg has joined #ocaml
mange has joined #ocaml
alfiee has joined #ocaml
<dh`>
the laziness in haskell lets you write new control-flow operators, and that does have some value
<dh`>
but, really, especially for exercises if you want haskell it's there