Exercises

A Complete Data-Family-Based ShellCommand

Continue with the example code from this chapter and refactor the ShellCommand module to use data families. Try to add a few more commands that wrap some of your favorite command line tools.

Better If Expressions

Earlier in the chapter you implemented conditionals inside of type families using IfThenElse. Instead of making this a single type family, try to use a mixture of GADTs and type families to explore other ways to encode conditionals that give you more flexibility, or more closely resemble term level conditionals.

Type Level map

Write a type family named Map that works like the term level map function. It should allow you to apply a function to each element of a type level list. Next, ...

Get Effective Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.