@@ -24,7 +24,6 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool (
2424 , SL. ApplyTxError (.. )
2525 , TxId (.. )
2626 , Validated (.. )
27- , WithTop (.. )
2827 , fixedBlockBodyOverhead
2928 , mkShelleyTx
3029 , mkShelleyValidatedTx
@@ -55,7 +54,7 @@ import Control.Monad.Except (Except)
5554import Control.Monad.Identity (Identity (.. ))
5655import Data.DerivingVia (InstantiatedAt (.. ))
5756import Data.Foldable (toList )
58- import Data.Measure (BoundedMeasure , Measure )
57+ import Data.Measure (Measure )
5958import qualified Data.Measure as Measure
6059import Data.Typeable (Typeable )
6160import GHC.Generics (Generic )
@@ -322,17 +321,17 @@ instance ( ShelleyCompatible p (AlonzoEra c)
322321
323322data AlonzoMeasure = AlonzoMeasure {
324323 byteSize :: ! ByteSize
325- , exUnits :: ! (ExUnits' ( WithTop Natural ) )
324+ , exUnits :: ! (ExUnits' Natural )
326325 } deriving stock (Eq , Generic , Show )
327326 deriving anyclass (NoThunks )
328- deriving (BoundedMeasure , Measure )
327+ deriving (Measure )
329328 via (InstantiatedAt Generic AlonzoMeasure )
330329
331330instance HasByteSize AlonzoMeasure where
332331 txMeasureByteSize = byteSize
333332
334- fromExUnits :: ExUnits -> ExUnits' ( WithTop Natural )
335- fromExUnits = fmap NotTop . unWrapExUnits
333+ fromExUnits :: ExUnits -> ExUnits' Natural
334+ fromExUnits = unWrapExUnits
336335
337336txMeasureAlonzo ::
338337 forall proto era .
@@ -369,7 +368,7 @@ data ConwayMeasure = ConwayMeasure {
369368 , refScriptsSize :: ! ByteSize
370369 } deriving stock (Eq , Generic , Show )
371370 deriving anyclass (NoThunks )
372- deriving (BoundedMeasure , Measure )
371+ deriving (Measure )
373372 via (InstantiatedAt Generic ConwayMeasure )
374373
375374instance HasByteSize ConwayMeasure where
@@ -396,39 +395,3 @@ instance ( ShelleyCompatible p (ConwayEra c)
396395 -- For post-Conway eras, this will become a protocol parameter.
397396 SL. maxRefScriptSizePerBlock
398397 }
399-
400- {- ------------------------------------------------------------------------------
401- WithTop
402- -------------------------------------------------------------------------------}
403-
404- -- | Add a unique top element to a lattice.
405- --
406- -- TODO This should be relocated to `cardano-base:Data.Measure'.
407- data WithTop a = NotTop ! a | Top
408- deriving (Eq , Generic , Show )
409- deriving anyclass (NoThunks )
410-
411- instance Ord a => Ord (WithTop a ) where
412- compare = curry $ \ case
413- (Top , Top ) -> EQ
414- (Top , _ ) -> GT
415- (_ , Top ) -> LT
416- (NotTop l, NotTop r) -> compare l r
417-
418- instance Measure a => Measure (WithTop a ) where
419- zero = NotTop Measure. zero
420- plus = curry $ \ case
421- (Top , _ ) -> Top
422- (_ , Top ) -> Top
423- (NotTop l, NotTop r) -> NotTop $ Measure. plus l r
424- min = curry $ \ case
425- (Top , r ) -> r
426- (l , Top ) -> l
427- (NotTop l, NotTop r) -> NotTop $ Measure. min l r
428- max = curry $ \ case
429- (Top , _ ) -> Top
430- (_ , Top ) -> Top
431- (NotTop l, NotTop r) -> NotTop $ Measure. max l r
432-
433- instance Measure a => BoundedMeasure (WithTop a ) where
434- maxBound = Top
0 commit comments