Haskell Cheat Sheet?

Has anybody made (or have a link to) a Haskell reference cheat sheet?
I'm thinking of a nice LaTeXed PDF in the 1-10 page range (e.g.
something like this http://www.tug.org/texshowcase/cheat.pdf) with the
basics of the language syntax, the type declarations for the common type
classes, the type signatures of the most commonly used functions in the
Prelude and other common modules, and so forth? The Haskell standard
library is very large for a newcomer (even just the Prelude!), and as a
learner of the language I find myself spending a lot of time looking up
Prelude functions and syntax details -- having all of this in a short
PDF document that I could have offline would be very useful.
--
Evan Klitzke

On Tue, Sep 25, 2007 at 01:04:56PM -0700, Evan Klitzke wrote:
Has anybody made (or have a link to) a Haskell reference cheat sheet?
the zvon ref is pretty close: http://www.zvon.org/other/haskell/Outputglobal/index.html in that it includes an overview of operators and common apis nice that it is in html. the pdf thing seems a bit contrived to me.

brad clawsie wrote:
nice that it is in html. the pdf thing seems a bit contrived to me.
Clearly you've never tried printing hard copies of HTML. ;-) Personally, I think having *both* is a nice idea. You can browse around the HTML, or you can print out hard copies to sit next to your computer. But maybe that's just me?

On 9/25/07, brad clawsie
On Tue, Sep 25, 2007 at 01:04:56PM -0700, Evan Klitzke wrote:
Has anybody made (or have a link to) a Haskell reference cheat sheet?
the zvon ref is pretty close:
http://www.zvon.org/other/haskell/Outputglobal/index.html
in that it includes an overview of operators and common apis
nice that it is in html. the pdf thing seems a bit contrived to me.
That's not really the same thing, if I'm understanding the original question correctly. I think the main points of such a cheat sheet would be that it is (a) organized *logically* (as opposed to zvon which is organized alphabetically) and (b) able to be easily (and beautifully) printed out. It's the kind of thing you would keep on your desk, right next to the keyboard, and you'd flip through it now and then when you have questions like, "now, what was the name of that function again? some? init? take? I forget." or, "which Arrow combinator do I want, (***) or (&&&)? I always get them confused." It could also include things like some of Cale's fold diagrams, funny quotes from #haskell, and so on. =) Anyway, I think it's a great idea. Maybe tomorrow I will start a wiki page to organize/discuss what information should be on such a "Haskell cheat sheet". No one's ever made one as far as I know. -Brent =)*

evan:
Has anybody made (or have a link to) a Haskell reference cheat sheet? I'm thinking of a nice LaTeXed PDF in the 1-10 page range (e.g. something like this http://www.tug.org/texshowcase/cheat.pdf) with the basics of the language syntax, the type declarations for the common type classes, the type signatures of the most commonly used functions in the Prelude and other common modules, and so forth? The Haskell standard library is very large for a newcomer (even just the Prelude!), and as a learner of the language I find myself spending a lot of time looking up Prelude functions and syntax details -- having all of this in a short PDF document that I could have offline would be very useful.

One suggestion: Section 3.6 defines a function "fix": fix :: Eq x => (x -> x) -> x -> x fix f x = if x == x' then x else fix f x' where x' = f x This confusingly differs in both type and meaning from the traditional function Control.Monad.Fix.fix and is not even used elsewhere in the document. I suggest that it be removed and the real Control.Monad.Fix.fix function be defined in its own section, with an side-by-side comparison with a named recursive function. This would be useful because the type fix :: (a -> a) -> a is highly confusing, suggesting to newcomers a usage like: f = fix (+1) which is undefined (and seems to be "missing an argument"), when invariably its type is in practice restricted to: fix :: ((a -> b) -> (a -> b)) -> (a -> b) which is much more suggestive (but nowhere to be found in the docs). Dan Weston Don Stewart wrote:
evan:
Has anybody made (or have a link to) a Haskell reference cheat sheet? I'm thinking of a nice LaTeXed PDF in the 1-10 page range (e.g. something like this http://www.tug.org/texshowcase/cheat.pdf) with the basics of the language syntax, the type declarations for the common type classes, the type signatures of the most commonly used functions in the Prelude and other common modules, and so forth? The Haskell standard library is very large for a newcomer (even just the Prelude!), and as a learner of the language I find myself spending a lot of time looking up Prelude functions and syntax details -- having all of this in a short PDF document that I could have offline would be very useful.
http://haskell.org/haskellwiki/Reference_card
? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, Sep 25, 2007 at 05:19:20PM -0700, Dan Weston wrote:
which is undefined (and seems to be "missing an argument"), when invariably its type is in practice restricted to:
fix :: ((a -> b) -> (a -> b)) -> (a -> b)
Oh, come on! I use fibs = fix $ (0:) . (1:) . uncurry ($) . (zipWith (+) &&& tail) in practice ALL the time!

I disagree -- see below Dan Weston wrote:
I suggest that it be removed and the real Control.Monad.Fix.fix function be defined in its own section, with an side-by-side comparison with a named recursive function. This would be useful because the type
fix :: (a -> a) -> a
is highly confusing, suggesting to newcomers a usage like:
f = fix (+1)
which is undefined (and seems to be "missing an argument"), when invariably its type is in practice restricted to:
fix :: ((a -> b) -> (a -> b)) -> (a -> b)
which is much more suggestive (but nowhere to be found in the docs).
Dan Weston
Useful counterexample: -- import Data.Function(fix) fix :: (t -> t) -> t fix f = let f' = f f' in f' one :: [Int] -> [Int] one = (1:) ones = [Int] ones = fix one This emphasizes that Haskell's fix can define non-function types, which the Y combinator in strict languages is not useful for. (Unless someone would like to correct me...) -- Chris

On Tue, 2007-09-25 at 17:19 -0700, Dan Weston wrote:
One suggestion:
Section 3.6 defines a function "fix":
fix :: Eq x => (x -> x) -> x -> x
fix f x = if x == x' then x else fix f x' where x' = f x
This confusingly differs in both type and meaning from the traditional function Control.Monad.Fix.fix and is not even used elsewhere in the document.
I suggest that it be removed and the real Control.Monad.Fix.fix function be defined in its own section, with an side-by-side comparison with a named recursive function. This would be useful because the type
fix :: (a -> a) -> a
is highly confusing, suggesting to newcomers a usage like:
f = fix (+1)
which is undefined (and seems to be "missing an argument"), when invariably its type is in practice restricted to:
fix :: ((a -> b) -> (a -> b)) -> (a -> b)
which is much more suggestive (but nowhere to be found in the docs).
Not invariably. I frequently use fix at monadic types, sometimes with an argument but not always. jcc

It seems no one liked idea #2. I still think fix is the wrong name for this, maybe limit would be better. Dan Weston wrote:
One suggestion:
Section 3.6 defines a function "fix":
fix :: Eq x => (x -> x) -> x -> x
fix f x = if x == x' then x else fix f x' where x' = f x
This confusingly differs in both type and meaning from the traditional function Control.Monad.Fix.fix and is not even used elsewhere in the document.
I suggest that it be removed and the real Control.Monad.Fix.fix function be defined in its own section, with an side-by-side comparison with a named recursive function. This would be useful because the type
fix :: (a -> a) -> a
is highly confusing, suggesting to newcomers a usage like:
f = fix (+1)
which is undefined (and seems to be "missing an argument"), when invariably its type is in practice restricted to:
fix :: ((a -> b) -> (a -> b)) -> (a -> b)
which is much more suggestive (but nowhere to be found in the docs).
Dan Weston
Don Stewart wrote:
evan:
Has anybody made (or have a link to) a Haskell reference cheat sheet? I'm thinking of a nice LaTeXed PDF in the 1-10 page range (e.g. something like this http://www.tug.org/texshowcase/cheat.pdf) with the basics of the language syntax, the type declarations for the common type classes, the type signatures of the most commonly used functions in the Prelude and other common modules, and so forth? The Haskell standard library is very large for a newcomer (even just the Prelude!), and as a learner of the language I find myself spending a lot of time looking up Prelude functions and syntax details -- having all of this in a short PDF document that I could have offline would be very useful.
http://haskell.org/haskellwiki/Reference_card
? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, 2007-09-26 at 11:43 -0700, Dan Weston wrote:
It seems no one liked idea #2. I still think fix is the wrong name for this, maybe limit would be better.
It calculates least fixed points. `fix' is as good a name as any. `limit' is terrible; the argument to fix, a -> a, is neither a sequence nor diagram nor net type, and hence its values don't have limits... jcc PS Yes, I know fix a = sup_{i=0}^inf f^i(bot). That sequence is rather different than the input function...
participants (9)
-
Andrew Coppin
-
brad clawsie
-
Brent Yorgey
-
ChrisK
-
Dan Weston
-
Devin Mullins
-
Don Stewart
-
Evan Klitzke
-
Jonathan Cast