-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
status: blockedThis issue or PR is blocked by something and cannot make progress.This issue or PR is blocked by something and cannot make progress.
Description
Proposing we add these mapN functions, and make them available to more than just List.
map2 :: forall a b c f. Functor f => (a -> b -> c) -> f a -> f b -> f c
map3 :: forall a b c d f. Functor f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
...
map10 ...We can then use the mapN functions to create zipN functions:
-- This already exists, but it would be nice to offer a more generic version:
zip :: forall a b f. Functor f => f a -> f b -> Tuple a b
zip = map2 Tuple
-- Likely needed to fill the gap between the seemingly-identical
-- (but actually different) `Tuple` and nested `Tuple2`.
zip2 :: forall a b f. Functor f => f a -> f b -> f (Tuple2 a b)
zip2 = map2 Tuple2
zip3 :: forall a b c f. Functor f => f a -> f b -> f c -> f (Tuple3 a b c)
zip3 = map3 Tuple3
...
zip10 :: ...
zip10 = map10 Tuple10We probably need a different typeclass than Functor though. What about Zippable?
A motivation for adding these functions is to get closer to Elm's usability in this area:
https://package.elm-lang.org/packages/elm/core/latest/List#map2
Metadata
Metadata
Assignees
Labels
status: blockedThis issue or PR is blocked by something and cannot make progress.This issue or PR is blocked by something and cannot make progress.