CS 313 - Lecture 33 - Intro to Haskell

No lecture, I just want you to teach yourself some basic Haskell, in 50 minutes or less.

There are many online tutorials and resources for learning Haskell. Here’s a list.

For this lecture, I recommend the following two, in either order.

1. Learn You a Haskell for Great Good!

A great book, available free online (click on "Read it online"). Read Chapter 1 Introduction (about 5 minutes) and Chapter 2 Starting Out (about 30 minutes). A lot of it should look very familiar given that you know Scheme and ML already. Focus on the differences, in particular lazy evaluation, which allows new things like working with infinite lists.

Optional: If you have extra time on your hands and are curious, also check out Chapter 3 Types and Typeclasses.

2. Try Haskell

An interactive tutorial in your browser (also available in the purple box on the main Haskell page).

Type "help" at the lambda prompt. This will start the tutorial, telling you what to try next. Work through the tutorial until at least it says "Lesson 4 complete" (20 steps), or until the end (25 steps). This should take about 10-15 minutes. Note that instead of typing in the suggested expressions, you can simply click on them.

Some of this tutorial may be confusing – it will make more sense after reading Chapter 2 of "Learn You a Haskell". Also note that it prints both the result of each expression and its type (starting with ::). You can ignore the types for now, which are also a bit confusing (see Chapter 3 of "Learn You a Haskell" if you want to understand the syntax).

If you want to install Haskell on your own computer (not required), you can find instructions here.

When you are done with the above reading and tutorial, complete the quiz:

Quiz 33

You are welcome to do additional reading and/or play with the online Haskell interpreter while you take the quiz.

In preparation for Monday’s class, please submit your questions about HW 10, the current material, or any other aspect of the course:

Your question

Both are due Monday by 10am