diff --git a/plutus-tx/src/PlutusTx/Data/AssocMap.hs b/plutus-tx/src/PlutusTx/Data/AssocMap.hs index 34d54126b93..2278dd63e69 100644 --- a/plutus-tx/src/PlutusTx/Data/AssocMap.hs +++ b/plutus-tx/src/PlutusTx/Data/AssocMap.hs @@ -209,11 +209,12 @@ safeFromList = . toOpaque . List.foldr (uncurry go) [] where + go :: k -> a -> [(BuiltinData, BuiltinData)] -> [(BuiltinData, BuiltinData)] go k v [] = [(P.toBuiltinData k, P.toBuiltinData v)] go k v ((k', v') : rest) = if P.toBuiltinData k == k' then (P.toBuiltinData k, P.toBuiltinData v) : go k v rest - else (P.toBuiltinData k', P.toBuiltinData v') : go k v rest + else (k', v') : go k v rest {-# INLINEABLE unsafeFromList #-} -- | Unsafely create an 'Map' from a list of pairs. @@ -238,7 +239,7 @@ noDuplicateKeys (Map m) = go m (\() -> True) ( \hd tl -> let k = BI.fst hd - in if member k (Map tl) then False else go tl + in if member' k tl then False else go tl ) {-# INLINEABLE all #-}