Skip to content

Commit

Permalink
Derive Semigroup and Monoid for TokenMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Dec 2, 2022
1 parent a30bacd commit 83ff536
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}
Expand Down Expand Up @@ -190,17 +191,12 @@ newtype TokenMap = TokenMap
}
deriving stock (Eq, Generic)
deriving (Read, Show) via (Quiet TokenMap)
deriving newtype (Semigroup, Monoid)

instance NFData TokenMap
instance Hashable TokenMap where
hashWithSalt = hashUsing toNestedList

instance Semigroup TokenMap where
(<>) = add

instance Monoid TokenMap where
mempty = empty

-- | A combination of a token policy identifier and a token name that can be
-- used as a compound identifier.
--
Expand Down

0 comments on commit 83ff536

Please sign in to comment.