nixpkgs/pkgs/development/libraries/haskell/regex-tdfa/fix-build-with-array5.patch

121 lines
4.8 KiB
Diff

diff -uwr regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_FA.hs regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_FA.hs
--- regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_FA.hs 2011-03-12 00:46:39.000000000 +0100
+++ regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_FA.hs 2013-12-19 12:42:27.048813869 +0100
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is the code for the main engine. This captures the posix
-- subexpressions. There is also a non-capturing engine, and a
-- testing engine.
@@ -20,7 +21,12 @@
import Prelude hiding ((!!))
import Control.Monad(when,unless,forM,forM_,liftM2,foldM)
+#if MIN_VERSION_array(0,4,0)
+import Data.Array.MArray(MArray(..))
+import Data.Array.Unsafe(unsafeFreeze)
+#else
import Data.Array.MArray(MArray(..),unsafeFreeze)
+#endif
import Data.Array.IArray(Array,bounds,assocs,Ix(range))
import qualified Data.IntMap.CharMap2 as CMap(findWithDefault)
import Data.IntMap(IntMap)
@@ -574,7 +580,7 @@
case unsafeCoerce# memcpy mdest msource n# s1# of { (# s2#, () #) ->
(# s2#, () #) }}
{-
-#else /* !__GLASGOW_HASKELL__ */
+-- #else /* !__GLASGOW_HASKELL__ */
copySTU :: (MArray (STUArray s) e (S.ST s))=> STUArray s Tag e -> STUArray s Tag e -> S.ST s (STUArray s i e)
copySTU source destination = do
@@ -585,5 +591,5 @@
forM_ (range b) $ \index ->
set destination index =<< source !! index
return destination
-#endif /* !__GLASGOW_HASKELL__ */
+-- #endif /* !__GLASGOW_HASKELL__ */
-}
diff -uwr regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine.hs regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine.hs
--- regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine.hs 2011-03-12 00:46:39.000000000 +0100
+++ regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine.hs 2013-12-19 12:42:27.049813918 +0100
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is the code for the main engine. This captures the posix subexpressions. This 'execMatch'
-- also dispatches to "Engine_NC", "Engine_FA", and "Engine_FC_NA"
--
@@ -19,7 +20,12 @@
-}
import Prelude hiding ((!!))
+#if MIN_VERSION_array(0,4,0)
+import Data.Array.MArray(MArray(..))
+import Data.Array.Unsafe(unsafeFreeze)
+#else
import Data.Array.MArray(MArray(..),unsafeFreeze)
+#endif
import Data.Array.IArray(Array,bounds,assocs,Ix(rangeSize,range))
import qualified Data.IntMap.CharMap2 as CMap(findWithDefault)
import Data.IntMap(IntMap)
@@ -716,7 +722,7 @@
case unsafeCoerce# memcpy mdest msource n# s1# of { (# s2#, () #) ->
(# s2#, () #) }}
{-
-#else /* !__GLASGOW_HASKELL__ */
+-- #else /* !__GLASGOW_HASKELL__ */
copySTU :: (MArray (STUArray s) e (S.ST s))=> STUArray s Tag e -> STUArray s Tag e -> S.ST s (STUArray s i e)
copySTU source destination = do
@@ -727,5 +733,5 @@
forM_ (range b) $ \index ->
set destination index =<< source !! index
return destination
-#endif /* !__GLASGOW_HASKELL__ */
+-- #endif /* !__GLASGOW_HASKELL__ */
-}
diff -uwr regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_NC_FA.hs regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_NC_FA.hs
--- regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_NC_FA.hs 2011-03-12 00:46:39.000000000 +0100
+++ regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_NC_FA.hs 2013-12-19 12:42:27.048813869 +0100
@@ -1,10 +1,16 @@
+{-# LANGUAGE CPP #-}
-- | This is the non-capturing form of Text.Regex.TDFA.NewDFA.String
module Text.Regex.TDFA.NewDFA.Engine_NC_FA(execMatch) where
import Control.Monad(unless)
import Prelude hiding ((!!))
+#if MIN_VERSION_array(0,4,0)
+import Data.Array.MArray(MArray(newArray))
+import Data.Array.Unsafe(unsafeFreeze)
+#else
import Data.Array.MArray(MArray(newArray),unsafeFreeze)
+#endif
import Data.Array.ST(STArray)
import qualified Data.IntMap.CharMap2 as CMap(findWithDefault)
import qualified Data.IntMap as IMap(null)
diff -uwr regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_NC.hs regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_NC.hs
--- regex-tdfa-1.1.8-orig/Text/Regex/TDFA/NewDFA/Engine_NC.hs 2011-03-12 00:46:39.000000000 +0100
+++ regex-tdfa-1.1.8-patched/Text/Regex/TDFA/NewDFA/Engine_NC.hs 2013-12-19 12:42:27.048813869 +0100
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | This is the non-capturing form of Text.Regex.TDFA.NewDFA.String
module Text.Regex.TDFA.NewDFA.Engine_NC(execMatch) where
@@ -5,7 +6,12 @@
import Data.Array.Base(unsafeRead,unsafeWrite)
import Prelude hiding ((!!))
+#if MIN_VERSION_array(0,4,0)
+import Data.Array.MArray(MArray(..))
+import Data.Array.Unsafe(unsafeFreeze)
+#else
import Data.Array.MArray(MArray(..),unsafeFreeze)
+#endif
import Data.Array.IArray(Ix)
import Data.Array.ST(STArray,STUArray)
import qualified Data.IntMap.CharMap2 as CMap(findWithDefault)
@@ -248,4 +254,3 @@
wsToGroup (WScratch start stop) = do
ma <- newArray (0,0) (start,stop-start) :: S.ST s (STArray s Int (MatchOffset,MatchLength))
unsafeFreeze ma
-