aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain GARBAGE <romain.garbage@inria.fr>2024-07-22 13:28:14 +0200
committerRicardo Wurmus <rekado@elephly.net>2024-07-23 00:31:20 +0200
commitc290c44c51ef385613fd835afc2ae7f1affc128e (patch)
tree8a44df79b85fad1586c7a55718c551d32825afab
parentc617cbb0fb968cbe66ab4f7a003bc2ee6dc85868 (diff)
downloadguix-c290c44c51ef385613fd835afc2ae7f1affc128e.tar
guix-c290c44c51ef385613fd835afc2ae7f1affc128e.tar.gz
gnu: Add ghc-unique.
* gnu/packages/haskell-xyz.scm (ghc-unique): New variable. * gnu/packages/patches/ghc-unique-support-newer-hashable.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Change-Id: Id9876b8018f5f8b3bcb82ab0bb13616ed298c31b
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/haskell-xyz.scm25
-rw-r--r--gnu/packages/patches/ghc-unique-support-newer-hashable.patch110
3 files changed, 136 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 16a31c4686..ef1e82eb04 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1347,6 +1347,7 @@ dist_patch_DATA = \
%D%/packages/patches/ghc-language-haskell-extract-ghc-8.10.patch \
%D%/packages/patches/ghc-memory-fix-32bit.patch \
%D%/packages/patches/ghc-persistent-fix-32bit.patch \
+ %D%/packages/patches/ghc-unique-support-newer-hashable.patch \
%D%/packages/patches/ghostscript-CVE-2023-36664.patch \
%D%/packages/patches/ghostscript-CVE-2023-36664-fixup.patch \
%D%/packages/patches/ghostscript-leptonica-hurd.patch \
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index b3e7a45602..006042fd14 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -13387,6 +13387,31 @@ operations. Uniplate has similar goals to the original Scrap Your Boilerplate
work, but is substantially simpler and faster.")
(license license:bsd-3)))
+(define-public ghc-unique
+ (package
+ (name "ghc-unique")
+ (version "0.4.7.9")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hackage-uri "Unique" version))
+ (sha256
+ (base32 "14f1qnmhdmbam8qis725dhwq1mk9h86fsnzhkwhsx73ny9z29s1l"))
+ (patches (search-patches "ghc-unique-support-newer-hashable.patch"))))
+ (build-system haskell-build-system)
+ (properties '((upstream-name . "Unique")))
+ (inputs (list ghc-extra ghc-hashable ghc-unordered-containers))
+ (native-inputs (list ghc-hspec ghc-quickcheck))
+ (arguments
+ `(#:cabal-revision ("1"
+ "10s0npnfkh7naj49afmyrvnilikp6426fbhi49f97pxrgcmy4dvw")))
+ (home-page "https://hackage.haskell.org/package/Unique")
+ (synopsis "Haskell functionality like \"uniq\" tool")
+ (description
+ "This library provides the functions to find unique and duplicate
+elements in a list.")
+ (license license:bsd-3)))
+
(define-public ghc-unix-compat
(package
(name "ghc-unix-compat")
diff --git a/gnu/packages/patches/ghc-unique-support-newer-hashable.patch b/gnu/packages/patches/ghc-unique-support-newer-hashable.patch
new file mode 100644
index 0000000000..279a00716d
--- /dev/null
+++ b/gnu/packages/patches/ghc-unique-support-newer-hashable.patch
@@ -0,0 +1,110 @@
+From b5e9f017bab8fad05cac47f2ac75841dc37c7f34 Mon Sep 17 00:00:00 2001
+From: Yura Lazarev <Unisay@users.noreply.github.com>
+Date: Wed, 14 Sep 2022 07:04:41 +0000
+Subject: [PATCH] Support hashable >=^ 1.4, improve unit tests.
+
+---
+ Unique.cabal | 2 +-
+ tests/UniqueStrict/RepeatedBy.hs | 4 ++--
+ tests/UniqueUnsorted/RemoveDuplicates.hs | 6 +++---
+ tests/UniqueUnsorted/RepeatedBy.hs | 8 ++++----
+ 4 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/Unique.cabal b/Unique.cabal
+index 1c03188..45dbbed 100644
+--- a/Unique.cabal
++++ b/Unique.cabal
+@@ -29,7 +29,7 @@ library
+ base >=4.0 && < 5,
+ containers >=0.5.0.0 && <=0.7,
+ extra >=1.6.2 && <=1.8,
+- hashable >= 1.2.6 && <=1.4,
++ hashable >= 1.2.6 && < 1.5,
+ unordered-containers >= 0.2.8 && <=0.3
+
+ test-suite HspecTest
+diff --git a/tests/UniqueStrict/RepeatedBy.hs b/tests/UniqueStrict/RepeatedBy.hs
+index 11eb180..04d8706 100644
+--- a/tests/UniqueStrict/RepeatedBy.hs
++++ b/tests/UniqueStrict/RepeatedBy.hs
+@@ -15,7 +15,7 @@ repeatedByTests =
+ repeatedBy (>100) ( [] :: [Int] ) `shouldBe` []
+
+ it "repeatedBy: simple test" $ do
+- repeatedBy (>2) "This is the test line" `shouldBe` " eist"
++ sort (repeatedBy (>2) "This is the test line") `shouldBe` " eist"
+
+ it "repeatedBy: returns [] when predicate (=< negative) " $
+ property $
+@@ -39,7 +39,7 @@ repeatedByTests =
+ it "repeatedBy: resulted elements should occur only once" $
+ property $
+ \ x xs -> x > 0
+- ==> all (==1) . map length . group $ repeatedBy (> x) ( xs :: String )
++ ==> all ((==1) . length) . group $ repeatedBy (> x) ( xs :: String )
+
+ it "unique: simple test" $ do
+ unique "foo bar" `shouldBe` " abfr"
+diff --git a/tests/UniqueUnsorted/RemoveDuplicates.hs b/tests/UniqueUnsorted/RemoveDuplicates.hs
+index 19b4e5f..93861c5 100644
+--- a/tests/UniqueUnsorted/RemoveDuplicates.hs
++++ b/tests/UniqueUnsorted/RemoveDuplicates.hs
+@@ -4,7 +4,7 @@ import Test.Hspec
+ import Test.QuickCheck
+
+ import Data.List.UniqueUnsorted
+-import Data.List (group)
++import Data.List (group, sort)
+
+
+ removeDuplicatesTests :: SpecWith ()
+@@ -15,7 +15,7 @@ removeDuplicatesTests =
+ removeDuplicates ( [] :: [Int] ) `shouldBe` []
+
+ it "removeDuplicates: simple test" $ do
+- removeDuplicates "foo bar" `shouldBe` " abrfo"
++ sort (removeDuplicates "foo bar") `shouldBe` " abfor"
+
+ it "removeDuplicates: multiple execution should return the same result" $
+ property $
+@@ -27,4 +27,4 @@ removeDuplicatesTests =
+
+ it "removeDuplicates: elements should occur only once #2" $
+ property $
+- \ xs -> all (==1) . map length . group $ removeDuplicates ( xs :: [Integer] )
++ \ xs -> all ((==1) . length) . group $ removeDuplicates ( xs :: [Integer] )
+diff --git a/tests/UniqueUnsorted/RepeatedBy.hs b/tests/UniqueUnsorted/RepeatedBy.hs
+index 54e3930..5550489 100644
+--- a/tests/UniqueUnsorted/RepeatedBy.hs
++++ b/tests/UniqueUnsorted/RepeatedBy.hs
+@@ -4,7 +4,7 @@ import Test.Hspec
+ import Test.QuickCheck
+
+ import Data.List.UniqueUnsorted
+-import Data.List (group)
++import Data.List (group, sort)
+
+
+ repeatedByTests :: SpecWith ()
+@@ -15,7 +15,7 @@ repeatedByTests =
+ repeatedBy (>100) ( [] :: [Int] ) `shouldBe` []
+
+ it "repeatedBy: simple test" $ do
+- repeatedBy (>2) "This is the test line" `shouldBe` " stei"
++ sort (repeatedBy (>2) "This is the test line") `shouldBe` " eist"
+
+ it "repeatedBy: returns [] when predicate (=< negative) " $
+ property $
+@@ -29,10 +29,10 @@ repeatedByTests =
+ it "repeatedBy: resulted elements should occur only once" $
+ property $
+ \ x xs -> x > 0
+- ==> all (==1) . map length . group $ repeatedBy (> x) ( xs :: String )
++ ==> all ((==1) . length) . group $ repeatedBy (> x) ( xs :: String )
+
+ it "unique: simple test" $ do
+- unique "foo bar" `shouldBe` " abrf"
++ sort (unique "foo bar") `shouldBe` " abfr"
+
+ it "repeated: simple test" $ do
+ repeated "foo bar" `shouldBe` "o"