Skip to content

Commit

Permalink
Add function intersection to module UTxO.
Browse files Browse the repository at this point in the history
This function is analogous to `Map.intersection`.
  • Loading branch information
jonathanknowles committed Sep 23, 2022
1 parent 96c0bfc commit a239567
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/wallet/src/Cardano/Wallet/Primitive/Types/UTxO.hs
Expand Up @@ -32,6 +32,7 @@ module Cardano.Wallet.Primitive.Types.UTxO
, restrictedBy
, restrictedTo
, difference
, intersection
, partition
, lookup
, filter
Expand Down Expand Up @@ -152,6 +153,9 @@ balance =
difference :: UTxO -> UTxO -> UTxO
difference a b = a `excluding` Map.keysSet (unUTxO b)

intersection :: UTxO -> UTxO -> UTxO
intersection (UTxO a) (UTxO b) = UTxO (a `Map.intersection` b)

-- | Indicates whether a pair of UTxO sets are disjoint.
--
disjoint :: UTxO -> UTxO -> Bool
Expand Down

0 comments on commit a239567

Please sign in to comment.