aelve / haskell-issues

An unofficial issue tracker for all things Haskell-related
18 stars 0 forks source link

Data.Distributive should implement zipWith #56

Open Gurkenglas opened 7 years ago

Gurkenglas commented 7 years ago

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