I need to apply a function to two lists. The map function is map :: (a->b) -> [a] -> [b]
, however I need something more like map2 :: (a->b->c) -> [a] -> [b] -> [c]
. Is there a prelude function similar to map
that can do this?
Asked
Active
Viewed 284 times
3

Will Ness
- 70,110
- 9
- 98
- 181

user15263733
- 83
- 4
-
2you can find those easily with Hoogle (see [here](https://www.stackage.org/lts-17.13/hoogle?q=%28a+-%3E+b+-%3E+c%29+-%3E+%5Ba%5D+-%3E+%5Bb%5D+-%3E+%5Bc%5D)) - for example [`zipWith`](https://www.stackage.org/haddock/lts-17.13/base-4.14.1.0/Prelude.html#v:zipWith) – Random Dev May 26 '21 at 10:07
1 Answers
9
You can find such function by hoogling (a -> b -> c) -> [a] -> [b] -> [c]
. Yes, it's called zipWith
.

snak
- 6,483
- 3
- 23
- 33