Implementing `pure` in ZipList
haskell
Solution
Take the identity law for Applicative Functors
pure id <*> v = v -- Identity
In the context of a ZipList, we generate the output by applying each function on the left of `<*>` by its corresponding value on the right side....
ZipList [f1, f2, f3, ....] <*> ZipList [v1, v2, v3, ....] =
ZipList [f1 v1, f2 v2, f3 v3, ....]
so, therefore, to get `v` back, we need each function on the left to be `id`.
pure id = [id, id, id, ....]
If the left side were a single function `[id]`, the right side would be just one item long.
Problem
Typeclassopedia presents this problem: Determine the correct definition of pure for the ZipList instance of Applicative—there is only one implementation that satisfies the law relating pure and (<*>). I wasn't sure how to solve it directly, so I tested it out in `ghci`: ``` ghci> pure 5 :: ZipList Int ZipList {getZipList = [5,5,5,5,5,5,5,5,5,5,5,5,5, ... ``` where `...` means endless `5`'s. Why is it implemented in such a way - to produce a list without end?