Bringing hs-plugins up to date
Ben Gamari
bgamari.foss at gmail.com
Sun Mar 18 18:36:22 CET 2012
Here are a few patches to get hs-plugins compiling again on GHC 7.4.1. The
first I stole from Brian Victor[1], while the second simply replaces
addrToHValue# with addrToAny# (a change apparently made in 7.4). There
are active codebases that rely on this package so it would be
appreciated if someone could push a new release of plugins with these
applied. Thanks!
Cheers,
- Ben
[1] http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/95185
P.S. Sorry, my darcs-fu isn't particluarly strong, so I ended I having
to edit the patches by hand to separate the changes. Hopefully they'll
still apply on your end.
diff -rN -u old-hs-plugins/src/System/Plugins/Load.hs new-hs-plugins/src/System/Plugins/Load.hs
--- old-hs-plugins/src/System/Plugins/Load.hs 2012-03-04 22:52:59.049531108 -0500
+++ new-hs-plugins/src/System/Plugins/Load.hs 2012-03-04 22:52:59.221531962 -0500
@@ -84,9 +84,15 @@
import System.Directory ( doesFileExist, removeFile )
import Foreign.C.String ( CString, withCString, peekCString )
+#if !MIN_VERSION_ghc(7,2,0)
import GHC ( defaultCallbacks )
+#endif
import GHC.Ptr ( Ptr(..), nullPtr )
#if DEBUG
@@ -99,7 +105,11 @@
readBinIface' :: FilePath -> IO ModIface
readBinIface' hi_path = do
-- kludgy as hell
+#if MIN_VERSION_ghc(7,2,0)
+ e <- newHscEnv undefined
+#else
e <- newHscEnv defaultCallbacks undefined
+#endif
initTcRnIf 'r' e undefined undefined (readBinIface IgnoreHiWay QuietBinIFaceReading hi_path)
-- TODO need a loadPackage p package.conf :: IO () primitive
@@ -679,7 +693,11 @@
-- and find some packages to load, as well.
let ps = dep_pkgs ds
+#if MIN_VERSION_ghc(7,2,0)
+ ps' <- filterM loaded . map packageIdString . nub $ map fst ps
+#else
ps' <- filterM loaded . map packageIdString . nub $ ps
+#endif
#if DEBUG
when (not (null ps')) $
diff -rN -u old-hs-plugins/src/System/Plugins/Load.hs new-hs-plugins/src/System/Plugins/Load.hs
--- old-hs-plugins/src/System/Plugins/Load.hs 2012-03-04 22:53:01.073541145 -0500
+++ new-hs-plugins/src/System/Plugins/Load.hs 2012-03-04 22:53:01.229541919 -0500
@@ -84,9 +84,15 @@
import GHC.Ptr ( Ptr(..), nullPtr )
+#if !MIN_VERSION_ghc(7,4,1)
import GHC.Exts ( addrToHValue# )
+#else
+import GHC.Exts ( addrToAny# )
+#endif
import GHC.Prim ( unsafeCoerce# )
#if DEBUG
@@ -445,7 +455,11 @@
ptr@(Ptr addr) <- withCString symbol c_lookupSymbol
if (ptr == nullPtr)
then return Nothing
+#if !MIN_VERSION_ghc(7,4,1)
else case addrToHValue# addr of
+#else
+ else case addrToAny# addr of
+#endif
(# hval #) -> return ( Just hval )
More information about the Libraries
mailing list