[Haskell-cafe] Haskell Cheat Sheet?
Dan Weston
westondan at imageworks.com
Tue Sep 25 20:19:20 EDT 2007
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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
More information about the Haskell-Cafe
mailing list