For more about motivation & design of TMap and its relationship to Map, see Denotational design with type class morphisms. -- Conal
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 this: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 cmapIn 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.- JakeOn Wed, Nov 14, 2012 at 3:50 PM, Jake McArthur <jake.mcarthur@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@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
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. :-(
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries