exercise

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

Exercise 9.3.1

Prove naturality of the vertical composite : .

Sources: DaoFP Exercise 9.3.1.

Solution: Solution 9.3.1

Exercise 9.3.2

Implement two versions of the horizontal composition of safeHead after reverse and compare.

Sources: DaoFP Exercise 9.3.2.

Solution: Solution 9.3.2

Exercise 9.3.3

Same for reverse after safeHead: reverse . fmap safeHead vs fmap safeHead . reverse of type [[a]] -> [Maybe a].

Sources: DaoFP Exercise 9.3.3.

Solution: Solution 9.3.3

Exercise 9.5.1

Show the limit of a diagram of shape the Walking Arrow () has the same elements as .

Sources: DaoFP Exercise 9.5.1.

Solution: Solution 9.5.1

Exercise 9.5.2

Check that (h q') . q == q' for q' x = testBit x 0 (with q n = even n, h q' True = q' 0, h q' False = q' 1).

Sources: DaoFP Exercise 9.5.2.

Solution: Solution 9.5.2

Exercise 9.6.1

Fill the gap in the Yoneda proof when .

Sources: DaoFP Exercise 9.6.1.

Solution: Solution 9.6.1

Exercise 9.6.2

Show that is natural in .

Sources: DaoFP Exercise 9.6.2.

Solution: Solution 9.6.2

Exercise 9.6.3

Derive from and naturality.

Sources: DaoFP Exercise 9.6.3.

Solution: Solution 9.6.3

Exercise 9.8.1

Describe limits and colimits as representing objects.

Sources: DaoFP Exercise 9.8.1.

Solution: Solution 9.8.1

Exercise 9.8.2

The singleton functor (on arrows, the unique map between singletons): show representable iff has an Initial Object.

Sources: DaoFP Exercise 9.8.2.

Solution: Solution 9.8.2

Exercise 9.8.3

Implement Representable for data Pair x = Pair x x.

Sources: DaoFP Exercise 9.8.3.

Solution: Solution 9.8.3

Exercise 9.8.4

Is the constant functor to the terminal object representable? Implement Representable for data Unit a = U.

Sources: DaoFP Exercise 9.8.4.

Solution: Solution 9.8.4

Exercise 9.8.5

The list functor is not representable; can it be considered a sum of representables?

Sources: DaoFP Exercise 9.8.5.

Solution: Solution 9.8.5