Re:OCamlers' critiques of Haskell
by mightybyte on Thursday August 27, 2015 @10:17AM
(#10129512)
Just a small side note, you don't even need to write your errorCode function. That and a number of other useful functions are provided in the errors package (http://hackage.haskell.org/package/errors). Also, I like to use string error messages because they're easier to grep for. Here's what your response function would look like with those changes.
[ Parent
| on HN ]
For anyone reading this, I want to confirm that mightybyte's code would be far more idiomatic. I would never use integer error codes in a Haskell program, but I wanted to make the clear connection to C idioms. Also, using the errors package would be more appropriate than rolling your own function there, but I wanted to emphasize that it was simple, two line function, and not any fancy wizardry that requires caring about category theory.
EDIT: rechecking the errors library, the final line would probably be more clear with
atNote "Not enough lines" lines 10