Skip to content

Commit 75dbbeb

Browse files
Remove stringsearch dependency (#2765)
Fixes #2726
1 parent 0065f04 commit 75dbbeb

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FIXED: Removed `stringsearch` dependency from `v16-upgrade-primitives`. See [#2726](https://github.com/clash-lang/clash-compiler/issues/2726)

clash-lib/clash-lib.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,9 @@ executable v16-upgrade-primitives
346346
yaml,
347347
bytestring,
348348
clash-lib,
349+
text,
349350
containers,
350351
directory,
351-
stringsearch,
352352
Glob
353353
GHC-Options: -Wall -Wcompat
354354
default-language: Haskell2010

clash-lib/tools/v16-upgrade-primitives.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ module Main where
99

1010
#if MIN_VERSION_aeson(2,0,0)
1111
import qualified Data.Aeson.KeyMap as Aeson
12-
import Data.ByteString.Lazy.Search (replace)
1312
import Data.String (IsString)
13+
import qualified Data.Text.Lazy as LazyText
14+
import qualified Data.Text.Lazy.Encoding as LazyText
1415
#endif
1516

1617
import qualified Data.Aeson.Extra as AesonExtra
@@ -89,9 +90,10 @@ customSortOutput x = case x of
8990
Just val -> Aeson.insert kNew val (Aeson.delete kOld obj)
9091

9192
removeTempKey :: ByteString -> ByteString
92-
removeTempKey inp = foldl go inp keySortingRenames
93+
removeTempKey inp =
94+
LazyText.encodeUtf8 (foldl go (LazyText.decodeUtf8 inp) keySortingRenames)
9395
where
94-
go bs (orig,temp) = replace (ByteString.toStrict temp) orig bs
96+
go txt (orig,temp) = LazyText.replace temp orig txt
9597
#else
9698
-- < aeson-2.0 stores keys in HashMaps, whose order we can't possibly predict.
9799
removeTempKey :: ByteString -> ByteString

0 commit comments

Comments
 (0)