1. 31

  2. 11

    I think it is one of the first “why xx rewritten in Rust” I read that is not about safety, borrow checker, etc. And also one of the simplest presentation of the trait system and deriving.

    I was reading Learn Haskell Fast and Hard and maybe that is why it was easier to grasp.

    1. 4

      FWIW, OCaml (I’m using OCaml/ReasonML interchangeably here) has stack traces and also a fairly mature ‘deriving’ mechanism with many common derivers already written.

      Stack traces are available by setting the environment variable OCAMLRUNPARAM=b, and a command-line interface can be derived from a record type using the Cmdliner deriving PPX. It even supports parsing custom types from command-line strings, like the URL example given in the OP. The equivalent to Rust’s reqwest::Url is Uri.t.

      Regarding not being able to understand the OCaml tar package, I get that. Often, package documentation is not very accessible from an outsider or beginner’s perspective. You kinda have to get used to the way people typically organize docs to understand that sometimes for effectful operations, the actual useful operations are in a separate subpackage with ‘unix’ somewhere in the name, for historical reasons, e.g. https://mirage.github.io/ocaml-tar/tar-unix/Tar_lwt_unix/Archive/index.html . And that decompressing a .tar.gz file, which is almost certainly what was required here, would actually need another package for gunzipping the file first to get the tar file, e.g. https://github.com/hcarty/ezgzip .

      All in all, Rust does have a lot of ergonomic niceties and a strong documentation culture. I think OCaml is evolving towards that too :-)