[Haskell-cafe] [ANN] Haskell Cheatsheet v1.0

Dino Morelli dino at ui3.info
Sat Oct 11 09:43:40 EDT 2008

On Fri, 10 Oct 2008, Justin Bailey wrote:

> I've created a "cheat sheet" for Haskell. It's a PDF that tries to
> summarize Haskell 98's syntax, keywords and other language elements.
> It's currently available on hackage[1]. Once downloaded, unpack the
> archive and you'll see the PDF. A literate source file is also
> included.
> The audience for this document is beginning to intermediate Haskell
> programmers. I found it difficult to look up some of the less-used
> syntax and other language stumbling blocks as I learned Haskell over
> the last few years, so I hope this document can help others in the
> future.
> Justin
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CheatSheet
> [2] git://github.com/m4dc4p/cheatsheet.git
> _______________________________________________

Justin (and everyone now contributing to this), thanks. This type of
thing is very helpful. There is a well-known one-page cheat-sheet like
this for Perl5 (and a newer one for Perl6 too). You can see it by typing
`perldoc perlcheat` on a system with Perl.

I wonder if we don't need something like that.

On a related note, I had come up with this short list to help with how
to read the Haskell symbols.

I email this out when trying to get new people started:

Haskell symbology

One thing that I found very difficult at first was how to read a lot of
the symbols in the Haskell code. I made up a small cheat-sheet that
explains how to read some of it:

Some definitions of Haskell symbols:

::      "has type"

->      "to"  The type 'Integer -> Integer' takes Integer as an argument
         and evaluates to an Integer. We say this type is
         "Integer to Integer"

=>      "evaluates" or "reduces to"

         Used in function type signatures, read something like this:

            foo :: (Bar b) => b -> c

         For all instances of type class Bar (here referred to as b),
         foo is a function from b to c. Or foo "has type" b to c.

[a]     "list of a"  The family of types consisting of, for every type
         a, the type of lists of a.

:       "cons"  List cons operator, adds first argument to the front of
         second, part of the List monad:

            (:) :: a -> [a] -> [a]

         Read: cons has type a to list of a to list of a

!!      List index operator  [ 1, 2, 3 ] !! 1 = 2  (lists are 0-based)

            (!!) :: [a] -> Int -> a

         Read: (!!) has type list of a to Int to a

|       "such that"

<-      "drawn from"

>>=     "bind"  Part of class Monad

>>      "then"  Part of class Monad

Dino Morelli  email: dino at ui3.info  web: http://ui3.info/d/  irc: dino-
pubkey: http://ui3.info/d/dino-4AA4F02D-pub.gpg

More information about the Haskell-Cafe mailing list