Add compatibility gorp for GHC 6.6.1.
authorMatt McCutchen <matt@mattmccutchen.net>
Wed, 30 Jul 2008 04:37:11 +0000 (00:37 -0400)
committerMatt McCutchen <matt@mattmccutchen.net>
Wed, 30 Jul 2008 04:38:18 +0000 (00:38 -0400)
program/CS2MinCostFlow.hs
program/Formatter.hs
program/Makefile
program/debug

index 47a73f5..5ce8086 100644 (file)
@@ -5,7 +5,12 @@ import System.IO.Unsafe
 import Data.Graph.Inductive.Graph
 import Data.Array.IArray
 import Data.List
+
+#if __GLASGOW_HASKELL__ <= 606
+(*) `on` f = \x y -> f x * f y
+#else
 import Data.Function
+#endif
 
 -- Configure the path to cs2.exe relative to the program/ directory here.
 cs2cmd = "./cs2.exe"
index 5ee5a00..ed851b3 100644 (file)
@@ -1,6 +1,10 @@
 module Formatter where
 import Data.List
 
+#if __GLASGOW_HASKELL__ <= 606
+intercalate xs xss = concat (intersperse xs xss)
+#endif
+
 padWith :: a -> Int -> [a] -> [a]
 padWith _ 0 l = l
 padWith e n [] = replicate n e
index df9942e..78eb667 100644 (file)
@@ -1,7 +1,9 @@
 # Let's keep it simple for now.
+# -cpp: Handle GHC 6.6.1 compatibility checks.
+# -fglasgow-exts: Handle rank-2 type of RandomizedMonad, among other things.
 all:
-       ghc -fglasgow-exts --make -c *.hs
+       ghc -cpp -fglasgow-exts --make -c *.hs
 all-optimized:
-       ghc -fglasgow-exts --make -O -hisuf O.hi -osuf O.o -c *.hs
+       ghc -cpp -fglasgow-exts --make -O -hisuf O.hi -osuf O.o -c *.hs
 clean:
        rm -f *.hi *.o
index 32e8157..f25ff9d 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/bash
 # Let ghci see only the source so it loads the modules debuggably.
-exec ghci -fglasgow-exts -hisuf D.hi -osuf D.o Test "$@"
+exec ghci -cpp -fglasgow-exts -hisuf D.hi -osuf D.o Test "$@"