Skip to content

Commit 3b07b22

Browse files
authored
Merge branch 'main' into main
2 parents bdfd962 + 8d194f2 commit 3b07b22

File tree

12 files changed

+4949
-1228
lines changed

12 files changed

+4949
-1228
lines changed

.gitpod.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ ENV PATH="/home/gitpod/.ghcup/bin:${PATH}"
77
# Install hls and stack
88
RUN ghcup install hls
99
RUN ghcup install stack
10+
11+
# Install zlib
12+
RUN sudo apt install -y zlib1g

Changes.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Proposed changes for next iteration/version
2+
3+
The idea of this file is to have a single source of truth as to which changes we want to do when we update the course.
4+
Feel free to provide a PR with more proposed changes!
5+
6+
## In general
7+
8+
9+
## Lesson 1
10+
11+
### Lecture
12+
-
13+
### Homework
14+
-
15+
16+
## Lesson 2
17+
18+
### Lecture
19+
- Add short explanation about type classes after polymorphysm. Just enough so the students don't struggle until we cover them properly on the type classes lesson.
20+
-
21+
22+
### Homework

FAQ.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# FAQ
2+
3+
### I can't run the code cells in the VSCode instance!
4+
5+
As of now, the Haskell kernel is configured to work only with a Binder instance. The VSCode instance is only for the homework. Mainly because we didn't want to encourage students to use their free 50 hs/month of GitPod while going through the lesson if there's a free and open-source alternative (Binder).
6+
7+
### There's no binder button!
8+
9+
If that's the case, that lesson hasn't been published yet. When it's finalized and recorded, we'll add the button.
10+
11+
### Do I have to pay anything to use all these resources?
12+
13+
NO!
14+
- The content is free and open source.
15+
- The cloud service we use to host the interactive versions is also free.
16+
- And the GitPod instance we use to run the VSCode has a free tier of 50 hs/month, which we believe will be more than enough. In the case you need more than 50 hs/month to do the homework, you can clone the repo and run everything locally (You can install everything using [GHCup](https://www.haskell.org/ghcup/).
17+
18+
### I want something to be different!
19+
20+
Tell us! We want this to be an easy and fun way to learn Haskell. If the community want's something different, we'll adapt the course!
21+
22+
### I have other questions!
23+
24+
- About Haskell? Look for the Haskell channel in [IOG's technical community](https://discord.com/invite/cmveaxuzBn). We'll be there to answer questions!
25+
- About the repo or the course itself? Create an [issue](https://github.com/input-output-hk/haskell-course/issues)!

Homework/Homework01/Homework01.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
-- Question 1
3+
-- Write a multiline comment below.
4+
5+
-- Question 2
6+
-- Define a function that takes a value and multiplies it by 3.
7+
8+
-- Question 3
9+
-- Define a function that calculates the area of a circle.
10+
11+
-- Question 4
12+
-- Define a function that calculates the volume of a cylinder by composing the previous function together with the height of the cylinder.
13+
14+
-- Question 5
15+
-- Define a function that takes the height and radius of a cylinder and checks if the volume is greater than or equal to 42.
16+

Homework/Homework02/Homework02.hs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
-- Question 1
3+
-- Add the type signatures for the functions below and then remove the comments and try to compile.
4+
-- (Use the types presented in the lecture.)
5+
6+
-- f1 x y z = x ** (y/z)
7+
8+
-- f2 x y z = sqrt (x/y - z)
9+
10+
-- f3 x y = [x == True] ++ [y]
11+
12+
-- f4 x y z = x == (y ++ z)
13+
14+
15+
-- Question 2
16+
-- Are really all variables in Haskell immutable? Try googling for the answer.
17+
18+
19+
-- Question 3
20+
-- Why should we define type signatures of functions? How can they help you? How can they help others?
21+
22+
23+
-- Question 4
24+
-- Why should you define type signatures for variables? How can they help you?
25+
26+
27+
-- Question 5
28+
-- Are there any functions in Haskell that let you transform one type to the other? Try googling for the answer.
29+
30+
31+
-- Question 6
32+
-- Can you also define in Haskell list of lists? Did we showed any example of that? How would you access the inner
33+
-- most elements?

Homework/Homework03/Homework03.hs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- Question 1
2+
-- Write a function that checks if the monthly consumption of an electrical device is bigger, equal, or smaller than the maximum allowed and
3+
-- returns a message accordingly.
4+
-- The function has to take the hourly consumption of an electrical device, the hours of daily use, and the maximum monthly consumption allowed.
5+
-- (Monthly usage = consumption (kW) * hours of daily use (h) * 30 days).
6+
7+
8+
-- Question 2
9+
-- Prelude:
10+
-- We use the function `show :: a -> String` to transform any type into a String.
11+
-- So `show 3` will produce `"3"` and `show (3 > 2)` will produce `"True"`.
12+
13+
-- In the previous function, return the excess/savings of consumption as part of the message.
14+
15+
16+
-- Question 3
17+
-- Write a function that showcases the advantages of using let expressions to split a big expression into smaller ones.
18+
-- Then, share it with other students in Canvas.
19+
20+
21+
-- Question 4
22+
-- Write a function that takes in two numbers and returns their quotient such that it is not greater than 1.
23+
-- Return the number as a string, and in case the divisor is 0, return a message why the division is not
24+
-- possible. To implement this function using both guards and if-then-else statements.
25+
26+
27+
-- Question 5
28+
-- Write a function that takes in two numbers and calculates the sum of squares for the product and quotient
29+
-- of those numbers. Write the function such that you use a where block inside a let expression and a
30+
-- let expression inside a where block.

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
For a more detailed explanation, keep reading or watch the introduction video:
66
[![YouTube](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=flat&logo=YouTube&logoColor=white)](https://youtu.be/H1vbUKMKvnM)
77

8-
## How much should I study if I only want to use Marlowe/Plutus?
8+
## How much should I study if I only wish to use Marlowe/Plutus?
99

1010
In the [outline](#what-well-cover) below, there are clear stopping points (for both Marlowe and Plutus) where we deem you to know enough Haskell to effectively use the technology.
1111

1212
## How to read/watch the lessons
1313

14-
To go through the interactive lessons, go to your chosen lesson's outline inside "[What we'll cover](#what-well-cover)" and click on the button that looks like the one below. If the page loads with a "500: Internal Server Error" just refresh it and it should be fine. At the top you will see a console that displays the progress of preparing your interactive lesson. During this time you can scroll down and look at the lesson, that is displayed non-interactively.
14+
To go through the interactive lessons, go to your chosen lesson's outline inside "[What we'll cover](#what-well-cover)" and click on the button that looks like the one below. If the page loads with a "500: Internal Server Error" just refresh it, and it should be fine. At the top, you will see a console that displays the progress of preparing your interactive lesson. During this time, you can scroll down and look at the lesson, that is displayed non-interactively.
1515

1616
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/input-output-hk/haskell-course/HEAD?labpath=%2Flessons%2F01-Introduction-to-haskell.ipynb)
1717

@@ -23,27 +23,36 @@ And to see the video, click on the button that looks like this:
2323

2424
1. Clone this repository.
2525
2. Create a [GitPod](https://www.gitpod.io/) account.
26-
3. Click this button to create a remote dev environment: [![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=flat&logo=visual-studio-code&logoColor=white)](https://gitpod.io/#https://github.com/rober-m/haskell-bootcamp)
27-
4. Select the `code/HomeworkXX` folder with the homework you want to complete.
26+
3. Click this button to create a remote dev environment: [![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=flat&logo=visual-studio-code&logoColor=white)](https://gitpod.io/#https://github.com/input-output-hk/haskell-course)
27+
4. Select the `Homework/HomeworkXX` folder with the homework you want to complete.
2828
5. Follow the instructions inside the app/Main.hs file.
29+
6. Check the solutions in the "solutions" branch!
2930

3031
#### Repository structure
3132

3233
Haskell-Course
3334
| |
34-
| |---- code
35+
| |---- Homework
3536
| |
3637
| |---- Homework01 (Homework for lesson 01)
3738
| |---- Homework02 (Homework for lesson 02)
3839
| ...
3940
|
40-
|-------- lessons (Lessons in Juptyer notebook format. Access through Binder.)
41+
|-------- lessons (Lessons in Jupyter notebook format. Access through Binder.)
4142
|
4243
|---- 1-Introduction-to-haskell
4344
|---- 2-Functions-Data-Types-and-Signatures
4445

4546
Everything else can be safely ignored
4647

48+
## FAQ
49+
50+
[FAQ](FAQ.md)
51+
52+
## Proposed changes for next iteration/version
53+
54+
[Changes](Changes.md)
55+
4756
## What we'll cover
4857

4958
**This is a tentative outline. Changes can (and will) be made as we advance with the course and gather feedback from students.**
@@ -66,7 +75,9 @@ Everything else can be safely ignored
6675
- How to open and use GitPod
6776
- Example of how to complete a homework assignment.
6877

69-
### 2. Data types, Signatures, and Polymorphism
78+
79+
### 2. Data types, Signatures, and Polymorphism [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/input-output-hk/haskell-course/HEAD?labpath=%2Flessons%2F02-Functions-Data-Types-and-Signatures.ipynb) [![YouTube](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=flat&logo=YouTube&logoColor=white)](https://youtu.be/RABzYje2d2A)
80+
7081

7182
- Pragmatic intro to types
7283
- Type signature
@@ -86,13 +97,14 @@ Everything else can be safely ignored
8697
- Tuples + Tuples VS Lists
8798
- Polymorphic values and type variables
8899

89-
### 3. Conditions and helper constructions
100+
### 3. Conditions and helper constructions [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/input-output-hk/haskell-course/HEAD?labpath=%2Flessons%2F03-Conditions-and-helper-constructions.ipynb) [![YouTube](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=flat&logo=YouTube&logoColor=white)](https://www.youtube.com/watch?v=G0XPELNZuws)
90101

91102
- If-then-else
92103
- Guards
93-
- `let`
104+
- `let` expressions
94105
- `where`
95-
- Using `let` and `where` together
106+
- Should I use `let` or `where`?
107+
- Things to keep in mind
96108

97109
### 4. Pattern matching and Case
98110

@@ -105,7 +117,7 @@ Everything else can be safely ignored
105117

106118
### 5. Improving and combining functions
107119

108-
- Higher order functions
120+
- Higher-order functions
109121
- Curried functions
110122
- Partial application
111123
- Composing and applying functions (`.` and `$` operators)
@@ -201,7 +213,7 @@ Everything else can be safely ignored
201213
- Cabal file
202214
- Using external libraries with Cabal
203215

204-
### 14. Learning on you own and Map
216+
### 14. Learning on your own and Map
205217

206218
- Using GHCi to find out more
207219
- Hoogle

code/Homework01/homework01.cabal

Lines changed: 0 additions & 64 deletions
This file was deleted.

code/Homework01/src/MyLib.hs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)