I’m trying to use Data.Map, mapWithKey. The compiler says it’s not exported by Data.Map. I checked every version in the documentation and I think all versions of Data.Map have mapWithKey. I’m not sure which version I’m using.
Wait… I get it. Map is a functor. So it’s just ‘map’ to do the equivalent of Haskell’s Map.map. But what is mapWithKey?
PureScript has the FunctorWithIndex
and FoldableWithIndex
classes. So mapWithKey
is mapWithIndex
Your confusion might be due to the fact that the Map
type was previously part of the package purescript-maps
, but now lives in purescript-ordered-containers
. Incidentally, if you’re using Bower, you can check which version of a given package you’re using by having a peek at bower_components/<package>/.bower.json
.
Perhaps mapWithKey
was removed after being made redundant by the FunctorWithIndex
class?