zipWith' f x y = map (uncurry f) (zip x y)
Rewrite the application for composition and eta-reduce:
-- \y -> let g = map (uncurry f); h = zip x in (g . h) y
-- let g = map (uncurry f); h = zip x in g . h
zipWith' f x = map (uncurry f) . zip x
Rewrite the infix in the prefix:
-- g . h = (.) g h
zipWith' f x = (.) (map (uncurry f)) (zip x)
Rewrite the application for composition and eta-reduce:
-- \x -> let g = (.) (map (uncurry f)); h = zip in (g . h) x
-- let g = (.) (map (uncurry f)); h = zip in g . h
zipWith' f = (.) (map (uncurry f)) . zip
Rewrite the infix in the prefix:
-- g . h = (.) g h
zipWith' f = (.) ((.) (map (uncurry f))) zip
flip f :
-- flip f x y = f y x
zipWith' f = flip (.) zip ((.) (map (uncurry f)))
:
-- g (h (i x)) = (g . h . i) x
zipWith' f = flip (.) zip (((.) . map . uncurry) f)
eta-reduce:
-- \f -> let g = flip (.) zip; h = (.) . map . uncurry in (g . h) f
-- let g = flip (.) zip; h = (.) . map . uncurry in g . h
zipWith' = (flip (.) zip) . ((.) . map . uncurry)
:
zipWith' = flip (.) zip . (.) . map . uncurry
, :
zipWith' = (. zip) . (.) . map . uncurry
.
-> Control.Arrow. , , \ f x y -> ..., , . \ (f, (x, y)) -> ...
\ (f, (x, y)) -> map (uncurry f) (zip x y)
(x, y), uncurry zip:
\ (f, (x, y)) -> map (uncurry f) (uncurry zip (x, y))
\ (f, xy) -> map (uncurry f) (uncurry zip xy)
: (uncurry uncurry zip) (f xy), ( map). *** Control.Arrow, :
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
, thats:
(***) @(->) :: (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
. !
uncurry *** uncurry zip
:: (a -> b -> c, ([x], [y])) -> ((a, b) -> c, [(x, y)])
uncurry f f. , uncurry map:
uncurry map . (uncurry *** uncurry zip)
:: (a -> b -> c, ([a], [b])) -> [c]
curry . : (f, xy) (x, y). curry:
curry $ uncurry map . (uncurry *** uncurry zip)
:: (a -> b -> c) -> ([a], [b]) -> [c]
fmap f -> "" :
fmap @((->) _) :: (a -> b) -> (t -> a) -> t -> b
, , fmap curry:
fmap curry $ curry $ uncurry map . (uncurry *** uncurry zip)
:: (a -> b -> c) -> [a] -> [b] -> [c]
! . , , :
zipWith' = untuple2 $ combineWith map apply zipped
where
untuple2 = fmap curry . curry
combineWith f g h = uncurry f . (g *** h)
apply = uncurry
zipped = uncurry zip
, , , , . Haskell, :
zipWith' f x y = map (uncurry f) (zip x y)
:
zipWith' f = map (uncurry f) .: zip
where (.:) = (.) . (.)