Skip to content

Commit

Permalink
improve by using a newtype deriving Show instead
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Nagel <[email protected]>
  • Loading branch information
ffakenz and ch1bo committed Aug 16, 2023
1 parent 6ab422c commit d2dad6b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions hydra-node/src/Hydra/Snapshot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module Hydra.Snapshot where

import Hydra.Prelude hiding (show)
import Hydra.Prelude

import Cardano.Crypto.Util (SignableRepresentation (..))
import Codec.Serialise (serialise)
Expand All @@ -15,15 +15,11 @@ import Hydra.Ledger (IsTx (..))
import PlutusLedgerApi.V2 (toBuiltin, toData)
import Test.QuickCheck (frequency, suchThat)
import Test.QuickCheck.Instances.Natural ()
import Text.Show (Show (..))

newtype SnapshotNumber
= UnsafeSnapshotNumber Natural
deriving (Eq, Ord, Generic)
deriving newtype (ToJSON, FromJSON, ToCBOR, FromCBOR, Real, Num, Enum, Integral)

instance Show SnapshotNumber where
show (UnsafeSnapshotNumber n) = show n
deriving newtype (Show, ToJSON, FromJSON, ToCBOR, FromCBOR, Real, Num, Enum, Integral)

instance Arbitrary SnapshotNumber where
arbitrary = UnsafeSnapshotNumber <$> arbitrary
Expand Down

0 comments on commit d2dad6b

Please sign in to comment.