concept tail in category haskell

appears as: tail, tail, The tail, The tail, tails
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

For tail, you can return the empty list if the list is empty:

This rule is nearly identical to rule 2, except you have to repeat your process. Don’t overthink or try to unwind the recursion. For a list, you might take the element and look at the tail. For washing dishes, you wash a dish, put it up to dry, and look in the sink again. The telemarketer either makes the call, records the sale, and repeats, or records that the call was made (no sale) and repeats.

The tail function in Haskell returns an error when called on an empty list. Modify myTail so that it does handle the case of an empty list by returning the empty list.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest