instance Applicative Data.Map
jake.mcarthur at gmail.com
Wed Nov 14 22:07:55 CET 2012
Now I'm just spamming, but I feel I should elaborate more.
A slight superset of the original semantics of Map can be recovered like
type Map k v = TMap k (Maybe v)
So, nothing is really lost, apart from the specific library I linked not
being very rich. Your example having intersection semantics would be
written like this:
(liftA3.liftA3) f amap bmap cmap
In fact, even this restricted form of TMap is still a monad (having the
same semantics as ReaderT k Maybe v). Come to think of it, there should be
a monad transformer version of TMap.
On Wed, Nov 14, 2012 at 3:50 PM, Jake McArthur <jake.mcarthur at gmail.com>wrote:
> Sorry for the double send, Henning. I forgot the list.
> On Wed, Nov 14, 2012 at 2:46 PM, Henning Thielemann <
> lemming at henning-thielemann.de> wrote:
>> 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
>> 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. :-(
>> Libraries mailing list
>> Libraries at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries