exercise

Exercises from DaoFP, Chapter 4. Solutions: DaoFP Chapter 4 Solutions. Index: Map of Content.

Exercise 4.1.1

Write the implementations of the three other functions Bool -> Bool (besides not). (Sum Type, Booleans)

Sources: DaoFP Exercise 4.1.1.

Solution: Solution 4.1.1

Exercise 4.4.1

Implement in Haskell the two functions forming the isomorphism Either a Void ≅ a (Sum Type, Initial Object).

Sources: DaoFP Exercise 4.4.1.

Solution: Solution 4.4.1

Exercise 4.4.2

Show that the bijection , , is natural (Sum Type, Natural Transformation).

Sources: DaoFP Exercise 4.4.2.

Solution: Solution 4.4.2

Exercise 4.4.3

Implement the function witnessing Either a b ≅ Either b a; note it is its own inverse (Sum Type).

Sources: DaoFP Exercise 4.4.3.

Solution: Solution 4.4.3

Exercise 4.4.4

Show that functoriality of the sum preserves composition: for and , applying equals applying (to get ) and then (Sum Type, Functor).

Sources: DaoFP Exercise 4.4.4.

Solution: Solution 4.4.4

Exercise 4.4.5

Show that functoriality of the sum preserves identity: (Sum Type).

Sources: DaoFP Exercise 4.4.5.

Solution: Solution 4.4.5