4 ms·
For those who understand networking: the Mirage TCP/IP networking stack [1] in pure OCaml is a must. It's an object of extreme beauty, and possibly the most
by mafribe 9y ago
For those who understand networking: the Mirage TCP/IP networking
stack [1] in pure OCaml is a must. It's an object of extreme beauty, and
possibly the most eloquent argument for types, types inference and
algebraic data types I can think of. The TCP state machine is mostly specified at type level [2], preventing numerous potential bugs in one fell swoop.
Reading this code is probably most enlightening if you have already written networking protocols.
NB: this has nothing to do with OCaml, other comparable languages with ADTs (Scala, Rust, Haskell, F#) would be similarly suitable.
[1] https://github.com/mirage/mirage-tcpip https://github.com/mirage/mirage-tcpip
[2] https://github.com/mirage/mirage-tcpip/blob/master/lib/tcp/state.ml https://github.com/mirage/mirage-tcpip/blob/master/lib/tcp/s...
- deleted 9y ago[deleted]
- SomeStupidPoint 9y agoThanks! I've been looking for something beyond basic tutorial apps to get a real feel for OCaml.
- pthreads 9y agoThank you. I haven't written networking protocols, yet. But hopefully I can still benefit from these.
- int08h 9y agoOnly looked at link [2], but wow. That state machine is brilliant. Don't know OCaml but am learning Rust and I see what you mean about the universality of how types make this possible. Thanks for pointing this out.