Skip to content

Commit f017be4

Browse files
authored
Drop hex-text package (#7181)
The `hex-text` package is poorly maintained and we are only using if for a single function that can be cargo culted into our code base. The cargo culted function relies on the `base16-bytestring` package but that is much more widely used and better maintained.
1 parent 085c9da commit f017be4

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

cabal.project

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,3 @@ allow-newer:
8787
-- flags: +force-build
8888
-- allow-newer: *:plutus-ledger-api
8989
-- allow-older: *:nothunks
90-
91-
if impl (ghc >= 9.12)
92-
allow-newer:
93-
-- https://github.com/typeclasses/hex-text/issues/9
94-
, hex-text:base
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Changed
2+
3+
- Drop `hex-text` package in favor of `base16-bytestring`.

plutus-core/plutus-core.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,14 @@ test-suite plutus-core-test
382382
build-depends:
383383
, aeson
384384
, base >=4.9 && <5
385+
, base16-bytestring ^>=1.0
385386
, bytestring
386387
, containers
387388
, data-default-class
388389
, extra
389390
, filepath
390391
, flat ^>=0.6
391392
, hedgehog
392-
, hex-text
393393
, mmorph
394394
, mtl
395395
, plutus-core ^>=1.48

plutus-core/plutus-core/test/CBOR/DataStability.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ where
3333
import PlutusCore.Data
3434

3535
import Codec.Serialise (deserialise)
36+
import Data.ByteString.Base16 qualified as Base16 (decode)
37+
import Data.ByteString.Char8 (ByteString)
3638
import Data.ByteString.Lazy qualified as BSL (fromStrict, length)
3739
import Data.Maybe (fromJust)
3840
import Data.Text (Text)
39-
import Text.Hex (decodeHex)
41+
import Data.Text.Encoding qualified as Text (encodeUtf8)
4042
import Text.Printf (printf)
4143

4244
import Test.Tasty
@@ -135,5 +137,8 @@ testData =
135137
)
136138
]
137139

138-
139-
140+
-- Lifted from the `hex-text` package which is being dropped because it
141+
-- is poorly maintained.
142+
decodeHex :: Text -> Maybe ByteString
143+
decodeHex txt =
144+
either (const Nothing) Just (Base16.decode (Text.encodeUtf8 txt))

0 commit comments

Comments
 (0)