mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Define the symmetric difference on live sets.
This commit is contained in:
parent
40d004a289
commit
67c633f3b0
@ -3,6 +3,7 @@ module Data.Abstract.Live where
|
||||
|
||||
import Data.Abstract.Address
|
||||
import Data.Bifunctor (second)
|
||||
import Data.Function (on)
|
||||
import Data.Functor.Classes.Generic
|
||||
import Data.Semigroup
|
||||
import Data.Set as Set
|
||||
@ -18,6 +19,9 @@ singleton = Live . Set.singleton
|
||||
delete :: Ord l => Address l v -> Live l v -> Live l v
|
||||
delete addr (Live s) = Live (Set.delete addr s)
|
||||
|
||||
difference :: Ord l => Live l v -> Live l v -> Live l v
|
||||
difference = fmap Live . (Set.difference `on` unLive)
|
||||
|
||||
member :: Ord l => Address l v -> Live l v -> Bool
|
||||
member addr = Set.member addr . unLive
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user