instance Applicative Data.Map
Roman Cheplyaka
roma at ro-che.info
Wed Nov 14 21:20:28 CET 2012
* Henning Thielemann <lemming at henning-thielemann.de> [2012-11-14 20:46:29+0100]
> An ZipList-like Applicative instance for Data.Map would be nice. I
> have an application where I like to write
> liftA3 f amap bmap cmap
> meaning
> Map.intersectionWith ($) (Map.intersectionWith f amap bmap) cmap
>
> But I cannot complete the instance implementation because there is no
> sensible definition for 'pure' for Data.Map. :-(
You can lift Map like this:
data ZipMap k a
= Pure a -- a "Map" that maps every possible key to 'a'
| Zip (Map k a)
Roman
More information about the Libraries
mailing list