We have worked on functions, higher order functions, and also worked with data types in Haskell. We have looked at functions such as map and filter in the context of the data type list. In many of these examples, we have taken a function that operates on data of type a and applied them in the context of the list of type a. Look at the following definition of map:
map :: (a -> b ) -> [a] -> [b]
You can clearly see that we have taken a function that operates on data type a and produces b, and we converted it to a function that takes a list of a and produces a list of b (map :: (a -> b) -> ([a] -> [b])). Instead of the list of a, we can think of some parametric data type T a. Now, we can rewrite the declaration of map as follows:
map :: (a -> b) -> T a -> T b
In short, the preceding definition of map applies to any data type T a, given...