First, great introduction. Keep it coming!

I write a fair bit of software in Haskell, and so I hope you won't mind a few suggestions. I'm numbering them to coincide with your section numbering.

1.1 You might want to make mention of higher-order functions, i.e., functions that operate on functions. It's implied by your description of first-class functions, but it's such an important part of functional programming that you might want to call more attention to it.

1.2 I don't find the comparison of Haskell's type system to that of C++ or Java's to be accurate. C++ and Java's type systems bring to mind "bondage and discipline" and require annoying, redundant type declarations all over the place. In Haskell, you are for the most part unshackled and can program without type annotations, reserving them for the few places where they add documentation value (or are needed to avoid ambiguity), and yet you still get their full benefit in all of your code.

2.5 You're not canceling free variables but rather bound variables. This canceling is commonly called "eta reduction." (The opposite is "lambda lifting.")

Also, your definition of any is actually that of or. Likewise, your all is actually and. The any and all functions in the Prelude take a predicate as their first argument and a list as their second. You probably meant the following:

anyprime xs = any prime xs allprime xs = all prime xs


In reply to Re: RFC: A Perlesque Introduction to Haskell, Part One (DRAFT) by tmoertel
in thread RFC: A Perlesque Introduction to Haskell, Part One (DRAFT) by FoxtrotUniform

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.