Commit f029ffcc authored by Gianfranco Costamagna's avatar Gianfranco Costamagna
Browse files

haskell-presburger: patch for new ghc 8.6.5

parent 9a9d68f6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
haskell-presburger (1.3.1-7) unstable; urgency=medium

  * Upstream fixes for new ghc
    - debian/patches/0b7ab4518debdd36add6bb967ef55e6be5dedfb9.patch:
    - debian/patches/fd7746dbc63d427ab5670341cd0fd13cb2c087b6.patch:

 -- Gianfranco Costamagna <locutusofborg@debian.org>  Sun, 25 Aug 2019 10:04:46 +0200

haskell-presburger (1.3.1-6) unstable; urgency=medium

  * Patch to build with ghc-8.4
+44 −0
Original line number Diff line number Diff line
## Description: add some description
## Origin/Author: add some origin or author
## Bug: bug URL
From 9d73e3d55fb44c81ce22a2d60bf7ad38ad1910a7 Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
Date: Mon, 15 Oct 2018 04:02:43 +0800
Subject: [PATCH] Fix compatibility with containers 0.6

---
 src/Data/Integer/SAT.hs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Data/Integer/SAT.hs b/src/Data/Integer/SAT.hs
index f10aba1..3fbf9a4 100644
--- a/src/Data/Integer/SAT.hs
+++ b/src/Data/Integer/SAT.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE BangPatterns, PatternGuards, Trustworthy #-}
+{-# LANGUAGE BangPatterns, PatternGuards, Trustworthy, CPP #-}
 {-|
 This module implements a decision procedure for quantifier-free linear
 arithmetic.  The algorithm is based on the following paper:
@@ -48,6 +48,9 @@ import           Control.Monad       (MonadPlus (..), ap, guard, liftM)
 import           Data.List           (partition)
 import           Data.Map            (Map)
 import qualified Data.Map            as Map
+#if MIN_VERSION_containers(0,6,0)
+import qualified Data.Map.Strict     as MapStrict
+#endif
 import           Data.Maybe          (fromMaybe, mapMaybe, maybeToList)
 import           Prelude             hiding ((<>))
 import           Text.PrettyPrint
@@ -955,7 +958,11 @@ tFactor (T c m) =
 
 -- | Extract a variable with a coefficient whose absolute value is minimal.
 tLeastAbsCoeff :: Term -> Maybe (Integer, Name, Term)
+#if MIN_VERSION_containers(0,6,0)
+tLeastAbsCoeff (T c m) = do (xc,x,m1) <- MapStrict.foldrWithKey step Nothing m
+#else
 tLeastAbsCoeff (T c m) = do (xc,x,m1) <- Map.foldWithKey step Nothing m
+#endif
                             return (xc, x, T c m1)
   where
   step x xc Nothing   = Just (xc, x, Map.delete x m)
+97 −0
Original line number Diff line number Diff line
## Description: add some description
## Origin/Author: add some origin or author
## Bug: bug URL
From fd7746dbc63d427ab5670341cd0fd13cb2c087b6 Mon Sep 17 00:00:00 2001
From: Hiromi ISHII <konn.jinro@gmail.com>
Date: Fri, 22 Dec 2017 17:03:17 +0900
Subject: [PATCH] Workaround for GHC 8.4 (hides Semigroup.<>)

---
 src/Data/Integer/SAT.hs | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/Data/Integer/SAT.hs b/src/Data/Integer/SAT.hs
index cfe3950..f10aba1 100644
--- a/src/Data/Integer/SAT.hs
+++ b/src/Data/Integer/SAT.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Trustworthy, PatternGuards, BangPatterns #-}
+{-# LANGUAGE BangPatterns, PatternGuards, Trustworthy #-}
 {-|
 This module implements a decision procedure for quantifier-free linear
 arithmetic.  The algorithm is based on the following paper:
@@ -43,12 +43,13 @@ module Data.Integer.SAT
 
 import Debug.Trace
 
-import           Data.Map (Map)
-import qualified Data.Map as Map
-import           Data.List(partition)
-import           Data.Maybe(maybeToList,fromMaybe,mapMaybe)
-import           Control.Applicative(Applicative(..), Alternative(..), (<$>))
-import           Control.Monad(liftM,ap,MonadPlus(..),guard)
+import           Control.Applicative (Alternative (..), Applicative (..), (<$>))
+import           Control.Monad       (MonadPlus (..), ap, guard, liftM)
+import           Data.List           (partition)
+import           Data.Map            (Map)
+import qualified Data.Map            as Map
+import           Data.Maybe          (fromMaybe, mapMaybe, maybeToList)
+import           Prelude             hiding ((<>))
 import           Text.PrettyPrint
 
 infixr 2 :||
@@ -85,9 +86,9 @@ assert p (State rws) = State $ fmap snd $ m =<< rws
 checkSat :: PropSet -> Maybe [(Int,Integer)]
 checkSat (State m) = go m
   where
-  go None            = mzero
-  go (One rw)        = return [ (x,v) | (UserName x, v) <- iModel (inerts rw) ]
-  go (Choice m1 m2)  = mplus (go m1) (go m2)
+  go None           = mzero
+  go (One rw)       = return [ (x,v) | (UserName x, v) <- iModel (inerts rw) ]
+  go (Choice m1 m2) = mplus (go m1) (go m2)
 
 allInerts :: PropSet -> [Inerts]
 allInerts (State m) = map inerts (toList m)
@@ -432,7 +433,7 @@ slnNextValWith f (TopVar x v lb ub is) =
      return $ TopVar x v1 lb ub is
 
 slnNextVar :: Solutions -> Maybe Solutions
-slnNextVar Done = Nothing
+slnNextVar Done                = Nothing
 slnNextVar (TopVar x v _ _ is) = Just $ FixedVar x v $ startIter $ iLet x v is
 slnNextVar (FixedVar x v i)    = FixedVar x v `fmap` slnNextVar i
 
@@ -716,9 +717,9 @@ instance Alternative Answer where
 
 instance MonadPlus Answer where
   mzero                = None
-  mplus None x         = x
+  mplus None x = x
   -- mplus (Choice x y) z = mplus x (mplus y z)
-  mplus x y            = Choice x y
+  mplus x y    = Choice x y
 
 instance Functor Answer where
   fmap _ None           = None
@@ -881,14 +882,14 @@ instance Show Term where
 ppTerm :: Term -> Doc
 ppTerm (T k m) =
   case Map.toList m of
-    [] -> integer k
-    xs | k /= 0 -> hsep (integer k : map ppProd xs)
-    x : xs      -> hsep (ppFst x   : map ppProd xs)
+    []     -> integer k
+    xs     | k /= 0 -> hsep (integer k : map ppProd xs)
+    x : xs -> hsep (ppFst x   : map ppProd xs)
 
   where
-  ppFst (x,1)   = ppName x
-  ppFst (x,-1)  = text "-" <> ppName x
-  ppFst (x,n)   = ppMul n x
+  ppFst (x,1)  = ppName x
+  ppFst (x,-1) = text "-" <> ppName x
+  ppFst (x,n)  = ppMul n x
 
   ppProd (x,1)  = text "+" <+> ppName x
   ppProd (x,-1) = text "-" <+> ppName x
+0 −12
Original line number Diff line number Diff line
Index: haskell-presburger/src/Data/Integer/SAT.hs
===================================================================
--- haskell-presburger.orig/src/Data/Integer/SAT.hs
+++ haskell-presburger/src/Data/Integer/SAT.hs
@@ -43,6 +43,7 @@ module Data.Integer.SAT
 
 import Debug.Trace
 
+import           Prelude hiding ((<>))
 import           Data.Map (Map)
 import qualified Data.Map as Map
 import           Data.List(partition)
+2 −1
Original line number Diff line number Diff line
fix-build-with-ghc-8.4.patch
fd7746dbc63d427ab5670341cd0fd13cb2c087b6.patch
0b7ab4518debdd36add6bb967ef55e6be5dedfb9.patch