@@ -23,7 +23,6 @@ module Ouroboros.Consensus.Shelley.Ledger.Mempool (
2323 , SL. ApplyTxError (.. )
2424 , TxId (.. )
2525 , Validated (.. )
26- , WithTop (.. )
2726 , fixedBlockBodyOverhead
2827 , mkShelleyTx
2928 , mkShelleyValidatedTx
@@ -54,8 +53,7 @@ import Control.Monad.Except (Except)
5453import Control.Monad.Identity (Identity (.. ))
5554import Data.DerivingVia (InstantiatedAt (.. ))
5655import Data.Foldable (toList )
57- import Data.Measure (BoundedMeasure , Measure )
58- import qualified Data.Measure as Measure
56+ import Data.Measure (Measure )
5957import Data.Typeable (Typeable )
6058import GHC.Generics (Generic )
6159import GHC.Natural (Natural )
@@ -322,13 +320,15 @@ instance ( ShelleyCompatible p (AlonzoEra c)
322320
323321data AlonzoMeasure = AlonzoMeasure {
324322 byteSize :: ! Mempool. ByteSize
325- , exUnits :: ! (ExUnits' ( WithTop Natural ) )
323+ , exUnits :: ! (ExUnits' Natural )
326324 } deriving stock (Eq , Generic , Show )
327- deriving (BoundedMeasure , Measure )
325+ deriving (Measure )
328326 via (InstantiatedAt Generic AlonzoMeasure )
329327
330- fromExUnits :: ExUnits -> ExUnits' (WithTop Natural )
331- fromExUnits = fmap NotTop . unWrapExUnits
328+ -- | This function used to do more, but now it's merely a synonym that avoids
329+ -- more import statements in modules that import this one.
330+ fromExUnits :: ExUnits -> ExUnits' Natural
331+ fromExUnits = unWrapExUnits
332332
333333txMeasureAlonzo ::
334334 forall proto era .
@@ -367,7 +367,7 @@ data ConwayMeasure = ConwayMeasure {
367367 alonzoMeasure :: ! AlonzoMeasure
368368 , refScriptsSize :: ! Mempool. ByteSize
369369 } deriving stock (Eq , Generic , Show )
370- deriving (BoundedMeasure , Measure )
370+ deriving (Measure )
371371 via (InstantiatedAt Generic ConwayMeasure )
372372
373373instance ( ShelleyCompatible p (ConwayEra c )
@@ -392,38 +392,3 @@ instance ( ShelleyCompatible p (ConwayEra c)
392392 -- For post-Conway eras, this will become a protocol parameter.
393393 SL. maxRefScriptSizePerBlock
394394 }
395-
396- {- ------------------------------------------------------------------------------
397- WithTop
398- -------------------------------------------------------------------------------}
399-
400- -- | Add a unique top element to a lattice.
401- --
402- -- TODO This should be relocated to `cardano-base:Data.Measure'.
403- data WithTop a = NotTop a | Top
404- deriving (Eq , Generic , Show )
405-
406- instance Ord a => Ord (WithTop a ) where
407- compare = curry $ \ case
408- (Top , Top ) -> EQ
409- (Top , _ ) -> GT
410- (_ , Top ) -> LT
411- (NotTop l, NotTop r) -> compare l r
412-
413- instance Measure a => Measure (WithTop a ) where
414- zero = NotTop Measure. zero
415- plus = curry $ \ case
416- (Top , _ ) -> Top
417- (_ , Top ) -> Top
418- (NotTop l, NotTop r) -> NotTop $ Measure. plus l r
419- min = curry $ \ case
420- (Top , r ) -> r
421- (l , Top ) -> l
422- (NotTop l, NotTop r) -> NotTop $ Measure. min l r
423- max = curry $ \ case
424- (Top , _ ) -> Top
425- (_ , Top ) -> Top
426- (NotTop l, NotTop r) -> NotTop $ Measure. max l r
427-
428- instance Measure a => BoundedMeasure (WithTop a ) where
429- maxBound = Top
0 commit comments