Skip to content

Commit

Permalink
Add 'Ord' instance for 'WalletState'
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed May 14, 2019
1 parent 00dc8b5 commit 4118e17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/core/src/Cardano/Wallet/Primitive/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ data WalletState

instance NFData WalletState

instance Ord WalletState where
Ready <= Ready = True
Ready <= Restoring _ = False
Restoring _ <= Ready = True
Restoring a <= Restoring b = a <= b

data WalletDelegation poolId
= NotDelegating
| Delegating !poolId
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/Data/Quantity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ instance ToText b => ToText (Quantity sym b) where
-- | Opaque Haskell type to represent values between 0 and 100 (incl).
newtype Percentage = Percentage
{ getPercentage :: Word }
deriving stock (Generic, Show, Eq)
deriving stock (Generic, Show, Eq, Ord)
deriving newtype (ToJSON)

instance NFData Percentage
Expand Down

0 comments on commit 4118e17

Please sign in to comment.