Exercise 9.5


applyAll :: [(a -> a)] -> a -> a
applyAll [] x = x
applyAll (f:fs) x = f (applyAll fs x)

4 responses to “Exercise 9.5”

  1. id, ($), (.) and \ aren’t introduced until later in the text, using concepts only from 9.1 and earlier, one answer would be:

    applyAll :: [(a -> a)] -> a -> a
    applyAll = flip (foldr aux)
    where aux f x = f x

Leave a Reply

Your email address will not be published. Required fields are marked *