about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-08-03 02:00:47 +0200
committerBas van Dijk <v.dijk.bas@gmail.com>2018-08-03 02:00:47 +0200
commit3328ea77492edff2aed1827fb435ecceb68e430d (patch)
tree41842717d149ff4df21c0571130e75fb516f6105
parent687771ced6dffd4a8662a068908cf4c78e3c264a (diff)
downloadnixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar.gz
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar.bz2
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar.lz
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar.xz
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.tar.zst
nixlib-3328ea77492edff2aed1827fb435ecceb68e430d.zip
haskellPackages.sexpr: fix build
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix7
-rw-r--r--pkgs/development/haskell-modules/patches/sexpr-0.2.1.patch86
2 files changed, 93 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index f2c2d8b2243f..9fcdef69c3fe 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -1128,4 +1128,11 @@ self: super: {
 
   # needed because of testing-feat >=0.4.0.2 && <1.1
   language-ecmascript = doJailbreak super.language-ecmascript;
+
+  # sexpr is old, broken and has no issue-tracker. Let's fix it the best we can. 
+  sexpr =
+    appendPatch (overrideCabal super.sexpr (drv: {
+      isExecutable = false;
+      libraryHaskellDepends = drv.libraryHaskellDepends ++ [self.QuickCheck];
+    })) ./patches/sexpr-0.2.1.patch;
 }
diff --git a/pkgs/development/haskell-modules/patches/sexpr-0.2.1.patch b/pkgs/development/haskell-modules/patches/sexpr-0.2.1.patch
new file mode 100644
index 000000000000..acafadba031e
--- /dev/null
+++ b/pkgs/development/haskell-modules/patches/sexpr-0.2.1.patch
@@ -0,0 +1,86 @@
+diff -Naurw sexpr-0.2.1/Codec/Sexpr/Internal.hs sexpr-0.2.1-patched/Codec/Sexpr/Internal.hs
+--- sexpr-0.2.1/Codec/Sexpr/Internal.hs	2009-04-30 00:51:06.000000000 +0200
++++ sexpr-0.2.1-patched/Codec/Sexpr/Internal.hs	2018-08-03 01:38:08.000000000 +0200
+@@ -62,11 +62,6 @@
+                               return $ List []]
+           arbSexpr n = oneof [Atom <$> arbitrary,
+                               List <$> (resize (n `div` 2) arbitrary)]
+-    coarbitrary (Atom s) = variant 0 . coarbitrary s
+-    coarbitrary (HintedAtom h s) = variant 1 . coarbitrary_h . coarbitrary s
+-        where coarbitrary_h = 
+-                foldr (\a b -> variant (ord a) . variant 1 . b) (variant 0) h
+-    coarbitrary (List ss) = variant 2 . coarbitrary ss
+ 
+ -- |@fold f s@ applies f to each sub-S-expression of s, from each leaf
+ -- to the root.  @f@ need not preserve the shape of @s@, in contrast
+diff -Naurw sexpr-0.2.1/Codec/Sexpr/Printer.hs sexpr-0.2.1-patched/Codec/Sexpr/Printer.hs
+--- sexpr-0.2.1/Codec/Sexpr/Printer.hs	2009-04-30 00:51:06.000000000 +0200
++++ sexpr-0.2.1-patched/Codec/Sexpr/Printer.hs	2018-08-03 01:41:56.000000000 +0200
+@@ -1,4 +1,4 @@
+-{-# LANGUAGE FlexibleInstances, OverlappingInstances #-}
++{-# LANGUAGE FlexibleInstances #-}
+ 
+ -- | Export S-expressions in any of the three ordinary forms: 
+ -- 
+@@ -17,6 +17,8 @@
+ 
+ module Codec.Sexpr.Printer where
+ 
++import Prelude hiding ((<>))
++
+ import Codec.Sexpr.Internal
+ 
+ import Data.Binary.Put
+@@ -30,7 +32,7 @@
+ instance Show (Sexpr String) where
+     show s = advancedString s
+ 
+-instance Show s => Show (Sexpr s) where
++instance {-# OVERLAPPABLE #-} Show s => Show (Sexpr s) where
+     show s = advancedString $ fmap show s
+ 
+ raw :: String -> String -> String
+diff -Naurw sexpr-0.2.1/Codec/Sexpr/Tests.hs sexpr-0.2.1-patched/Codec/Sexpr/Tests.hs
+--- sexpr-0.2.1/Codec/Sexpr/Tests.hs	2009-04-30 00:51:06.000000000 +0200
++++ sexpr-0.2.1-patched/Codec/Sexpr/Tests.hs	2018-08-03 01:46:32.000000000 +0200
+@@ -67,11 +67,9 @@
+ 
+ instance Arbitrary B.ByteString where
+     arbitrary = B.pack `fmap` arbitrary
+-    coarbitrary = undefined
+ 
+ instance Arbitrary Char where
+   arbitrary     = choose (32,255) >>= \n -> return (chr n)
+-  coarbitrary n = variant (ord n)
+ 
+ 
+ main :: IO ()
+diff -Naurw sexpr-0.2.1/sexpr.cabal sexpr-0.2.1-patched/sexpr.cabal
+--- sexpr-0.2.1/sexpr.cabal	2018-08-03 01:36:11.000000000 +0200
++++ sexpr-0.2.1-patched/sexpr.cabal	2018-08-03 01:49:13.000000000 +0200
+@@ -13,23 +13,9 @@
+ maintainer:          bts@evenmere.org
+ build-type: 	     Simple
+ 
+-flag testing
+-    description: build test executable
+-    default: False
+-
+ library
+-    if flag(testing)
+-       ghc-options: -Wall
+-    Build-Depends: base, base64-string, pretty, bytestring, binary
++    Build-Depends: base, base64-string, pretty, bytestring, binary, QuickCheck
+     Exposed-modules: Codec.Sexpr
+-
+-executable sexpr-test
+-    if !flag(testing)
+-        buildable: False
+-        ghc-options: -Wall
+-    main-is: Codec/Sexpr/Tests.hs
+-    other-modules:  Codec.Sexpr
+-                    Codec.Sexpr.Parser
++    other-modules:  Codec.Sexpr.Parser
+                     Codec.Sexpr.Printer
+                     Codec.Sexpr.Internal
+-    build-depends: QuickCheck, random