@@ -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,8 +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 )
59- import qualified Data.Measure as Measure
57+ import Data.Measure (Measure )
6058import Data.Typeable (Typeable )
6159import GHC.Generics (Generic )
6260import GHC.Natural (Natural )
@@ -322,17 +320,17 @@ instance ( ShelleyCompatible p (AlonzoEra c)
322320
323321data AlonzoMeasure = AlonzoMeasure {
324322 byteSize :: ! ByteSize
325- , exUnits :: ! (ExUnits' ( WithTop Natural ) )
323+ , exUnits :: ! (ExUnits' Natural )
326324 } deriving stock (Eq , Generic , Show )
327325 deriving anyclass (NoThunks )
328- deriving (BoundedMeasure , Measure )
326+ deriving (Measure )
329327 via (InstantiatedAt Generic AlonzoMeasure )
330328
331329instance HasByteSize AlonzoMeasure where
332330 txMeasureByteSize = byteSize
333331
334- fromExUnits :: ExUnits -> ExUnits' ( WithTop Natural )
335- fromExUnits = fmap NotTop . unWrapExUnits
332+ fromExUnits :: ExUnits -> ExUnits' Natural
333+ fromExUnits = unWrapExUnits
336334
337335txMeasureAlonzo ::
338336 forall proto era .
@@ -369,7 +367,7 @@ data ConwayMeasure = ConwayMeasure {
369367 , refScriptsSize :: ! ByteSize
370368 } deriving stock (Eq , Generic , Show )
371369 deriving anyclass (NoThunks )
372- deriving (BoundedMeasure , Measure )
370+ deriving (Measure )
373371 via (InstantiatedAt Generic ConwayMeasure )
374372
375373instance HasByteSize ConwayMeasure where
@@ -396,39 +394,3 @@ instance ( ShelleyCompatible p (ConwayEra c)
396394 -- For post-Conway eras, this will become a protocol parameter.
397395 SL. maxRefScriptSizePerBlock
398396 }
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