I am currently learning Applicatives in Haskell. If I am not wrong, there are two different Applicative instances for Lists, (List
and ZipList
- the second being defined as a newtype wrapping a List value). The ZipList
applicative instances seems more intuitive for me.
It might be a dumb question, but is there a specific reason ZipList
is not the default Applicative instance for Lists.
pure (+) <*> [1,2,3] <*> [4,5,6]
-- [5,6,7,6,7,8,7,8,9]
pure (+) <*> ZipList [1,2,3] <*> ZipList [4,5,6]
-- ZipList [5,7,9]
Is it because the distributive version of Applicative List also happens to have a Monad instance?