Re:Applicative WTF?
by nybble41 on Wednesday October 24, 2018 @11:40AM
(#18293350)
Yes, though that definition results in:
pure id <*> ZipList [x, y, z] == ZipList [x]
and thus breaks one of the Applicative laws:
pure id <*> v == v
The standard ZipList definition is `pure a = ZipList (repeat a)` (an infinite list).
The issue with defining a Monad instance for ZList is that mapping the function on the right of (>>=) over the ZList on the left gets you a ZList of `ZList b`, with no meaningful way to zip these ZLists together.
The issue with defining a Monad instance for ZList is that mapping the function on the right of (>>=) over the ZList on the left gets you a ZList of `ZList b`, with no meaningful way to zip these ZLists together.