Skip to content

Commit 801f027

Browse files
committed
Update my answers in ch6
1 parent a41e9fe commit 801f027

File tree

5 files changed

+34
-26
lines changed

5 files changed

+34
-26
lines changed

ch6/ex3.hs renamed to ch6/ex1.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
-- Exercises: Eq Instances
2+
3+
14
-- 1
25

36
data TisAnInteger = TisAn Integer

ch6/ex1.txt

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

ch6/ex2.txt

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
1-
1.
1+
Exercises: Tuple Experiment
22

3-
max (length [1, 2, 3]) (length [8, 9, 10, 11, 12])
4-
= max 3 5
5-
= 5
63

7-
2.
4+
quotRem :: Integral a => a -> a -> (a, a)
5+
quotRem x y = (x quot y, x rem y)
86

9-
compare (3 * 4) (3 * 5)
10-
= compare 12 15
11-
= LT
12-
13-
3.
14-
15-
compare "Julie" True
16-
17-
This will result in an error since True is not of type [Char].
18-
19-
4.
20-
21-
(5 + 3) > (3 + 6)
22-
= 8 > 9
23-
= False
7+
divMod :: Integral a => a -> a -> (a, a)
8+
divMod x y = (x div y, x mod y)

ch6/ex3.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Exercises: Will They Work?
2+
3+
1.
4+
5+
max (length [1, 2, 3]) (length [8, 9, 10, 11, 12])
6+
= max 3 5
7+
= 5
8+
9+
2.
10+
11+
compare (3 * 4) (3 * 5)
12+
= compare 12 15
13+
= LT
14+
15+
3.
16+
17+
compare "Julie" True
18+
19+
This will result in an error since True is not of type [Char].
20+
21+
4.
22+
23+
(5 + 3) > (3 + 6)
24+
= 8 > 9
25+
= False

ch6/ex4.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ For e.g. since [Int] will satisfy the type signature we would end up passing a
213213
list of Ints to mySort which will result in a type error because it can only
214214
take a list of Chars.
215215

216-
Type-Kwon-Do
216+
Type-Kwon-Do Two: Electric Typealoo
217217

218218
1.
219219

0 commit comments

Comments
 (0)