I’m very new to functional programming. I know concepts like Monad, and my first functional or partially functional language that I’m studying is OCaml. I’ve read a lot of the mirage-tcpip stack and it uses Lwt everywhere. Since I’ve seen no other ways to do multithreaded programs and things similar to loops, Lwt seems to me the only way to do it.
Why Lwt is not a part of the OCaml language itself? Is there another way of doing the amazing things Lwt does?
I’m mainly asking because even though I fint Lwt very useful, it looks like it’s cheating. Lwt doesn’t look very functional to me.
I searched the Lwt code and found in github that it contains 23.9% of C code. Is part of this C code used to implement Lwt or the C code is simply for interfacing with system IO?
In other words, does OCaml have native support for thread creation?
The root of my question are tied to verifiability and how reliable is OCaml code that uses Lwt, because if Lwt uses C for threads than it’s very dependent on code that might contain bugs like buffer overflows and null pointers that I want to avoit at all.