News for hackers. Stuff that matters.
Re:High-Performance Web Applications in Haskell by alavrik on Wednesday April 06, 2011 @02:48AM (#2414161)
Fair enough. I didn't mean to criticize Haskell. In fact, I'm planning to learn it.

I was just surprised that this code was presented as a good example of Haskell's fit to the parsers domain. It would be interesting to see if my perception of this code changes once I get more familiar with the language.

Re:High-Performance Web Applications in Haskell by pjscott on Wednesday April 06, 2011 @03:37AM (#2414249)
Ah, okay, I misunderstood you. Yes, I think your perception of the code will change. In particular, the operators from Control.Applicative (the ones that look especially like line noise) are critical to making heads or tails of it. When I posted that link, I momentarily forgot that they're not obvious. They make sense after you've used them for a little while, though.
Re:High-Performance Web Applications in Haskell by jamii on Wednesday April 06, 2011 @04:32AM (#2414353)
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

Mirage (using MPL for zero copy parsing) https://github.com/avsm/mirage/blob/master/lib/net/direct/mp...

Re:High-Performance Web Applications in Haskell by alavrik on Thursday April 07, 2011 @11:32PM (#2422304)
Hi 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 :)