How to read Haskell: Difference between revisions

From HaskellWiki
No edit summary
No edit summary
Line 9: Line 9:
-- something we can work through slowly (and show why we find it beautiful)
-- something we can work through slowly (and show why we find it beautiful)
</haskell>
</haskell>
=== Hint: use type signatures ===
When you see stuff like this
<haskell>
-- example please!
foo :: Bar Ping Pong -> Baz Zed Dubya -> IO (DoublePlus Good)
</haskell>
...don't fight it!  These are type signatures and they are an incredibly useful way of getting a rough idea what a function is supposed to do.
:''elaborate''


== What confuses non-Haskellers ==
== What confuses non-Haskellers ==

Revision as of 10:50, 3 August 2006

This stub is intended to become a tutorial on reading Haskell. It's aimed at the non-Haskeller who probably doesn't care too much about trying to write code, but wants to understand it.

The tutorial

...needs to be written

-- insert here some horrible (for the non-Haskeller) long example
-- something we can work through slowly (and show why we find it beautiful)

Hint: use type signatures

When you see stuff like this

-- example please!
foo :: Bar Ping Pong -> Baz Zed Dubya -> IO (DoublePlus Good)

...don't fight it! These are type signatures and they are an incredibly useful way of getting a rough idea what a function is supposed to do.

elaborate

What confuses non-Haskellers

Since this tutorial is not yet written, we encourage you to note here the things which confuse non-Haskellers about the code code.

  • layout instead of semicolons?
  • super-super-concise stuff (things using liftM and liftM2)
  • the difference between
    x <- foo
    and
    x = foo