Skip to content
  • Matt Renaud's avatar
    Fix Foldable instance for IntMap (fixes #579) (#593) · 4bd9f7ad
    Matt Renaud authored
    * Fix Foldable instance for IntMap.
    
    As reported in https://github.com/haskell/containers/issues/579 the Foldable
    instance for IntMap is unlawful and internally inconsistent. This was caused as
    a result of the internal representation used by IntMap.
    
    More specifically, `fold`, `foldMap`, and `traverse` (via `traverseWithKey`)
    always placed positively keyed entries before negative keyed ones. To fix this
    we need to check to see if the mask is positive or negative.
    
    Tested by adding new property tests, verifying they failed with the
    implementation at HEAD, and then passed after the changes.
    
    
    4bd9f7ad
To find the state of this project's repository at the time of any of these versions, check out the tags.