Skip to content

Problem with Monoid instance of Data.Map

See..

http://www.haskell.org/pipermail/libraries/2007-May/007491.html

Data.Map Monoid instance is currently..

instance (Ord k) => Monoid (Map k v) where
    mempty  = empty
    mappend = union
    mconcat = unions
  1. .but probably should be..
instance (Ord k, Monoid v) => Monoid (Map k v) where
 mempty            = empty
 mappend map0 map1 = unionWith mappend map0 map1
 mconcat maps      = foldr (unionWith mappend) empty maps

Adrian Hey

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Multiple
Architecture Multiple
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information