Skip to content

Commit

Permalink
Simplify PartialOrd instance for TokenMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Dec 2, 2022
1 parent 56aa3a1 commit e03f0a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs
Expand Up @@ -148,6 +148,7 @@ import Data.Semigroup.Cancellative
, Reductive
, RightCancellative
, RightReductive
, isPrefixOf
)
import Data.Set
( Set )
Expand Down Expand Up @@ -280,9 +281,7 @@ instance TypeError ('Text "Ord not supported for token maps")
-- In the above example, map 'x' is strictly less than map 'y'.
--
instance PartialOrd TokenMap where
m1 `leq` m2 = F.all
(\a -> getQuantity m1 a <= getQuantity m2 a)
(getAssets m1 `Set.union` getAssets m2)
leq = isPrefixOf

-- | Defines a lexicographic ordering.
--
Expand Down

0 comments on commit e03f0a5

Please sign in to comment.