3 ms·
I write a lot of ocaml code (for money, even!) and haven't touched haskell for about four years. I still find the haskell version here easier to read. I imagine
by jamii 16y ago
I write a lot of ocaml code (for money, even!) and haven't touched haskell for about four years. I still find the haskell version here easier to read. I imagine what's tripping you up is the operator soup. Whilst ugly (one of the things that turned me off haskell) it is a lot easier to read once you are familiar with basic haskell typeclasses (applicative, functor etc). That said, the ocaml version could definitely be a lot nicer. Check out eg
Yojson (search for 'let positive_int') http://forge.ocamlcore.org/scm/browser.php?group_id=153 http://forge.ocamlcore.org/scm/browser.php?group_id=153
Mirage (using MPL for zero copy parsing) https://github.com/avsm/mirage/blob/master/lib/net/direct/mpl/protocols/ethernet.mpl https://github.com/avsm/mirage/blob/master/lib/net/direct/mp...
- alavrik 16y agoHi there! I do quite a bit of both OCaml and Erlang. In fact, I borrowed Yojson's json parser for my project (piqi.org). Also, I'm familiar with MPL. It looks very nice, but from what I heard it is fairly immature. And you definitely can't parse HTTP this way :)