Merge pull request #3758 from doyougnu/cardano-perf-regression/umap-base-perf
Cardano-Perf regression: UMap.size regression fix
Cardano-Perf regression: UMap.size regression fix
hashFromPackedBytes $
PackedBytes28 a b c (fromIntegral (d `shiftR` 32))
pure $! Addr network paymentCred (StakeRefBase stakeRef)
{-# INLINE decodeAddress28 #-}
data AlonzoTxOut era
= TxOutCompact'
TxOut_AddrHash28_AdaOnly_DataHash32 stakeRef addr28Extra _ _
| Just addr <- decodeAddress28 stakeRef addr28Extra -> Left addr
| otherwise -> error "Impossible: Compacted an address or a hash of non-standard size"
{-# INLINEABLE getEitherAddrBabbageTxOut #-}
{-# INLINE getEitherAddrBabbageTxOut #-}
-- TODO: Switch to using `getDatumBabbageTxOut`
getDataBabbageTxOut :: Era era => BabbageTxOut era -> StrictMaybe (Data era)
txIxFromIntegral :: Integral a => a -> Maybe TxIx
txIxFromIntegral = fmap (TxIx . fromIntegral) . word16FromInteger . toInteger
{-# INLINE txIxFromIntegral #-}
-- | Construct a `TxIx` from an arbitrary precision `Integer`. Throws an error for
-- values out of range. Make sure to use it only for testing.
certIxFromIntegral :: Integral a => a -> Maybe CertIx
certIxFromIntegral = fmap (CertIx . fromIntegral) . word16FromInteger . toInteger
{-# INLINE certIxFromIntegral #-}
-- | Construct a `CertIx` from an arbitrary precision `Integer`. Throws an error for
-- values out of range. Make sure to use it only for testing.
word16FromInteger i
| i < fromIntegral (minBound :: Word16) || i > fromIntegral (maxBound :: Word16) = Nothing
| otherwise = Just (fromInteger i)
{-# INLINE word16FromInteger #-}
-- =================================
TFFEF r p v -> (SJust r, p, SNothing, SJust v)
TFFFE r p s -> (SJust r, p, SJust s, SNothing)
TFFFF r p s v -> (SJust r, p, SJust s, SJust v)
{-# INLINE umElemAsTuple #-}
-- | Extract a delegated reward-deposit pair if it is present.
-- We can tell that the pair is present and active when Txxxx has
TFFFE rdA _ _ -> Just rdA
TFFFF rdA _ _ _ -> Just rdA
_ -> Nothing
{-# INLINE umElemRDActive #-}
-- | Extract the reward-deposit pair if it is present.
-- We can tell that the reward is present when Txxxx has an F in the first position
TFFFE r _ _ -> Just r
TFFFF r _ _ _ -> Just r
_ -> Nothing
{-# INLINE umElemRDPair #-}
-- | Extract the set of pointers if it is non-empty.
-- We can tell that the reward is present when Txxxx has an F in the second position
TFFFE _ p _ | not (Set.null p) -> Just p
TFFFF _ p _ _ | not (Set.null p) -> Just p
_ -> Nothing
{-# INLINE umElemPtrs #-}
-- | Extract the stake delegatee pool id, if present.
-- We can tell that the pool id is present when Txxxx has an F in the third position
TFFFE _ _ s -> Just s
TFFFF _ _ s _ -> Just s
_ -> Nothing
{-# INLINE umElemSPool #-}
-- | Extract the voting delegatee id, if present.
-- We can tell that the delegatee is present when Txxxx has an F in the fourth position
TFFEF _ _ d -> Just d
TFFFF _ _ _ d -> Just d
_ -> Nothing
{-# INLINE umElemDRep #-}
-- | A `UMElem` can be extracted and injected into the `TEEEE` ... `TFFFF` constructors.
pattern UMElem ::
Alonzo builds