haskell-issues
haskell-issues copied to clipboard
Data.Distributive should implement zipWith
Because as far as I can see it is safe but requires partial functions to implement:
type Pair a a = Pair a a deriving Functor
zipWith :: Distributive g => (a -> b -> c) -> g a -> g b -> g c
zipWith f x y = cotraverse hack $ Pair (fmap Left x) (fmap Right y) where
hack (Pair (Left x) (Right y)) = f x y