3 ms·
Seems pretty good to me. (I know a little Haskell, but only a little.) I think you and the original author are using different standards of readability. Yours:
by gjm11 17y ago
Seems pretty good to me. (I know a little Haskell, but only a little.) I think you and the original author are using different standards of readability. Yours: "If I look at this code, starting without knowing anything about it, does it look familiar?" His: "Once I've taken a few minutes to get the hang of this, is it easy to read and write?".
Here, the <|> and <$> and <* are unfamiliar and weird-looking: fair enough. But once you know that <|> means "or", and <$> means "try to parse some of the input using the thing on the right, and then the thing on the left is the resulting value", and <* means "try to parse both of these, and return the result of parsing the first one", it's hard to see how it could be much simpler.
- DannoHung 17y agoEven in that code block, <|> and <$> both have roughly the common meanings of | and $ elsewhere in Haskell, which is the "next case" operator for pattern matching expressions and the strictness operator for ensuring that a function is applied to a value correctly. Only <* is a really new construction.
- shrughes 17y ago...and the strictness operator for ensuring that a function is applied to a value correctly. ($) isn't any kind of strictness operator -- maybe you're thinking of ($!). ($) is a plain old function application operator.
- blasdel 17y agoIt's strictness for applicative precedence, as ($) is the least of the operators, like a greedy open-paren.