Portfolio-based approach to learning Haskell
Haskell Univiersty is a community driven project, where one can learn Haskell by solving exercieses. You will create programs that each week will gain on complexity. Aim is to learn both the language as well as its real world application by exploring as many libraries, frameworks and tools as possible.
Haskell University is designed to be self-paced, each exercies has a deadline estimated in weeks - you can start at anytime and just keep your private schedule. However because it hardly ever works :), starting 26th Novemeber we initialized first edition that will keep public schedule. If you will take that challange, please create PR adding yourself to the list of students!
This is community driven project. You are more then welcome to share your ideas, PRs and comments!
For more information, see our FAQ. If you are experienced Haskell developer, please see 2.
First edition of Haskell University just started!
You can join by adding your name to the list of students with a link to the repository where you will push your solutions to the exercises. This is purely done for transparency. You will see other people taking part in the challange, so we all can learn from each other. Once you've added yourself to that list, you can consider yourself enrolled :) From now on you must solve each exercise by the end of the deadline. We have a gitter channel where you can talk with fellow students, exchange ideas, reason about solutions.
Student | Repository |
---|---|
Pawel Szulc | solutions |
Lukasz Byczynski | solutions |
Jakub Janczak | solutions |
Bartosz Bonisławski | solutions |
Igor Mielientiev | solutions |
Przemek Kamiński | solutions |
Christian Sakai | solutions |
Wisnu Adi Nurcahyo | solutions |
Doug Fort | solutions |
Florian Schmeller | solutions |
Doug Fort | solutions |
Florian Schmeller | solutions |
Doug Fort | solutions |
Florian Schmeller | solutions |
Artur Czajka | solutions |
Eryk Ciepiela | solutions |
Stanislaw Findeisen | solutions |
Christopher Davenport | solutions |
Andrew R. M. | solutions |
Michał Michalski | solutions |
Bartek Kalinka | solutions |
Exercise | Deadline |
---|---|
1. Hello World | 03 December 2017 |
2. Fun with lists | 17 December 2017 |
3. Apples and oranges | 31 December 2017 |
4. Reverse Polish notation calculator | 07 January 2018 |
5. Advanced Calculator | 14 January 2018 |
deadline: 1 week
We will cover:
- How to init a new Haskell project
- using the
IO
type - divide project to modules
This week is all about getting started. Familiarize yourself with Stack and basic concepts of the language: function definition and application, module creation, IO
type.
Programs:
$ stack exec exercise1-exe
Hello World
$ stack exec exercise1-exe
Hello, what is your name?
Pawel
Nice to meet you Pawel
$ stack exec exercise1-exe
Hello, what is your name?
Pawel
Nice to meet you Pawel
Hello, what is your name?
Mike
Nice to meet you Mike
Hello, what is your name?
Kate
Nice to meet you Kate
Hello, what is your name?
hints: import Control.Monad (forever)
deadline: 2 weeks
We will cover:
- List API
- Property based testing using Quick Check
- Our first typeclass:
Ord
This week we will do exercies that appear occasionally at job interviews: Quicksort algorithm and FizzBuzz. Both solutions should manifest themself the beauty of the Haskell language - once you are done, just compare them with anything written in any other programming language.
They are both perfect for mastering some functions available for List
. They also help get intuition when reasoning about lazy evaluation.
Abstract version of quicksort implementation will require to understand concept of a typeclass and usage of an Ord
typeclass.
We will also have to test our solutions, so this is a great opportunity to introduce QuickCheck.
Programs:
- Implement a Quicksort algorithm that will take a list of integers as an input and return a sorted list of integers as an output. We are not looking for the most performant version, just the simplest version of this well known divide and conquer algorithm.
- Write property based tests using QuickCheck that will test your solution. Think about the properties that you can check.
$ stack exec exercise2-exe 3 32 2 1 2 5 5 321 1 123 12 3 43 345
[1,1,2,2,3,3,5,5,12,32,43,123,321,345]
- Extend your Quicksort algorithm to work with a list of any arbitrary type
- What are possible constraints on that type?
- Implement a program FizzBuzz that will take a number as an input and generate list of strings as the output containing the "fizzbuzz" sequence
- Can you think of any properties that you could test with QuickCheck?
deadline: 1 week
Programs:
- You are building a checkout system for a shop which only sells apples and oranges.
- Apples cost 60p and oranges cost 25p.
- Build a checkout system which takes a list of items scanned at the till and outputs the total cost For example: [ Apple, Apple, Orange, Apple ] => £2.05
The shop decides to introduce two new offers
- buy one, get one free on Apples
- 3 for the price of 2 on Oranges
Update your checkout functions accordingly
deadline: 1 week
We will cover:
- Parser combinators
Write "Reverse Polish notation calculator". Program runs forever where it:
- promts user for the input expression (written in Reverse Polish notation
- reads user input
- evaluates user input: a) if it is a valid expression, it will evaluate its value b) if it is an invalid input (not an expression) then it will warn user about it
Example:
> 10 20 +
30
> 100 80 -
20
> 10 2 /
5
> 10 sdfsd /
Could not evaluate '10 sdfsd /'
Reading material:
- "Learn you a Haskell" on Reverse Polish notation
- "Haskell - Programming from first Principles" by Ch.Allen & J.Moronuki chapter 24 "Parser Combinators"
- "Programming Haskell" by Graham Hutton, chapter 8 "Functional Parsers"
deadline: 1 week
We will cover:
- State monad
Add new feature to the calculator you implemented in Exercise 2. This time each time you evaluate an expression, its value is printed out along with the name of the variable that will hold its value. That variable can be used in further calculations.
Example:
> 20 10 +
res0: 30
> 100 res0 -
res1: 70
> res1 res50 /
Could not evaluate 'res1 res50 /'
Originally Haskell University's intent is to provide challenges, problems to solve. It's the students responsibility to explore the topic on his/her own. However
- occasionally we will point to book chapters, blog posts as hints for the exercies
- we encourage the community to post solutions to the problems (via blogposts, gists, repositories, youtube videos), we will be more then happy to include them as solutions along the exercies.
Yes! We need your help. We need experienced Haskell developers to create exercies for us, to challange students. If you have an idea for an exercise, please submit an issue or add it directly as a pull request to this README.md