

Haskell is beautiful in practice - mariusae
http://monkey.org/~marius/haskell-is-beautiful-in-practice.html

======
jpcx01
This article reads like an april fools joke. In one code block, he shows the
most complex, incomprehensible haskell code (with special characters sprinkled
in all over the place), then the next paragraph he confidently explains how
it's so readable and straightforward to understand.

Haskell is cool, but it's one of those languages I'm going to have to accept
that I'm not smart enough to program in.

~~~
jpcx01
A hilarious example from the post:

    
    
        p_term :: Parser Term
        p_term = t <* spaces    
          where 
            t =     IntTerm               <$> p_num (readSigned readDec)
                <|> FloatTerm             <$> p_num (readSigned readFloat)
                <|> AtomTerm              <$> p_atom
                <|> TupleTerm             <$> p_tuple
                <|> BytelistTerm . C.pack <$> p_string
                <|> ListTerm              <$> p_list
                <|> BinaryTerm   . B.pack <$> p_binary
    

"Again, reading very naturally"

~~~
gjm11
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
Even 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
_...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
It's strictness for applicative precedence, as ($) is the least of the
operators, like a greedy open-paren.

------
mark_l_watson
Well, I liked the article - I have worked through the real world haskell book
just enough to sort-of understand this article :-)

That said, I gave up on Haskell. I spend a lot of time semi-learning languages
because it is fun. But, for practicality, I really concentrate on knowing just
Ruby, Common Lisp, and Java very well.

Striking a good balance between practicality and having fun is not so easy to
do.

------
teeja
Some people say mathematics is beautiful. After several years, unfortunately,
I could never see that beauty. There was a point, long ago, where I could see
the beauty of Forth.

Ditto with Bach. On the other hand, I 'get' the beauty of Beethoven and the
Boards. To each his own ... but 'beauty' is _de gustibus_ , and mere
functionality does not qualify.

