GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:56:14Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/5242IntMap.differenceKeysSet for removing an IntSet of keys2019-07-07T18:56:14ZliyangIntMap.differenceKeysSet for removing an IntSet of keysCurrently, `IntMap.difference ma mb` removes all the keys in `mb` from `ma`, where the elements of the two `IntMap`s can be of different types; the elements of `mb` are not used.
There is no efficient way to remove an `IntSet` of keys, ...Currently, `IntMap.difference ma mb` removes all the keys in `mb` from `ma`, where the elements of the two `IntMap`s can be of different types; the elements of `mb` are not used.
There is no efficient way to remove an `IntSet` of keys, however. These patches adds the `IntMap.differenceKeysSet` function—essentially a copy/paste of `difference`—that satisfies the following property:
```
prop_DiffKeysSet :: Map Int -> Map () -> Bool
prop_DiffKeysSet t1 t2
= difference t1 t2 == differenceKeysSet t1 (keysSet t2)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 7.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries (other) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"IntMap.differenceKeysSet for removing an IntSet of keys","status":"New","operating_system":"","component":"libraries (other)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.1","keywords":["containers"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"Currently, {{{IntMap.difference ma mb}}} removes all the keys in `mb` from `ma`, where the elements of the two `IntMap`s can be of different types; the elements of `mb` are not used.\r\n\r\nThere is no efficient way to remove an `IntSet` of keys, however. These patches adds the `IntMap.differenceKeysSet` function—essentially a copy/paste of `difference`—that satisfies the following property:\r\n{{{\r\nprop_DiffKeysSet :: Map Int -> Map () -> Bool\r\nprop_DiffKeysSet t1 t2\r\n = difference t1 t2 == differenceKeysSet t1 (keysSet t2)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1milanmilanhttps://gitlab.haskell.org/ghc/ghc/-/issues/1816Add Data.Set.mapMaybe2019-07-07T19:11:36ZguestAdd Data.Set.mapMaybeThis function is also available for lists (from Data.Maybe) and Maps (Data.Set).
The semantics are straightforward:
```
mapMaybe f = fromList . catMaybes . map f . toList
```
<details><summary>Trac metadata</summary>
| Trac field ...This function is also available for lists (from Data.Maybe) and Maps (Data.Set).
The semantics are straightforward:
```
mapMaybe f = fromList . catMaybes . map f . toList
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 6.8 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown |
| Architecture | Unknown |
</details>
<!-- {"blocked_by":[],"summary":"Add Data.Set.mapMaybe","status":"New","operating_system":"Unknown","component":"libraries/base","related":[],"milestone":"Not GHC","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.8","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown","cc":[""],"type":"Bug","description":"This function is also available for lists (from Data.Maybe) and Maps (Data.Set).\r\nThe semantics are straightforward:\r\n{{{\r\nmapMaybe f = fromList . catMaybes . map f . toList\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.6.1milanmilan