diff options
author | David Waern <david.waern@gmail.com> | 2008-10-10 20:33:38 +0000 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2008-10-10 20:33:38 +0000 |
commit | ff03f4f8b4ac1b9ccd9ef93c294ac835871c349f (patch) | |
tree | 3cee68382d8029088b54154188c7396cf563731d /src/Haddock/InterfaceFile.hs | |
parent | 8a57f3d9eb971ab4957f2780ed7a0b5be0b3b6e3 (diff) |
Make Haddock build with GHC 6.8.2
Diffstat (limited to 'src/Haddock/InterfaceFile.hs')
-rw-r--r-- | src/Haddock/InterfaceFile.hs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index 226d3acc..9ad22431 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -15,6 +15,7 @@ module Haddock.InterfaceFile ( import Haddock.DocName () import Haddock.Types +import Haddock.Utils import Data.List import Data.Word @@ -37,7 +38,6 @@ import FastMutInt import HsDoc import FastString import Unique -import MonadUtils ( MonadIO(..) ) data InterfaceFile = InterfaceFile { @@ -57,16 +57,7 @@ binaryInterfaceMagic = 0xD0Cface -- Instead of adding one, we add three to all version numbers -- when one of our own (stored) datatypes is changed. binaryInterfaceVersion :: Word16 -#if __GLASGOW_HASKELL__ == 608 && __GHC_PATCHLEVEL__ == 2 binaryInterfaceVersion = 2 -#endif -#if __GLASGOW_HASKELL__ == 608 && __GHC_PATCHLEVEL__ == 3 -binaryInterfaceVersion = 3 -#endif -#if __GLASGOW_HASKELL__ >= 609 -binaryInterfaceVersion = 4 -#endif - initBinMemSize :: Int initBinMemSize = 1024*1024 @@ -145,6 +136,8 @@ writeInterfaceFile filename iface = do type NameCacheAccessor m = (m NameCache, NameCache -> m ()) + +#if __GLASGOW_HASKELL__ >= 609 nameCacheFromGhc :: NameCacheAccessor Ghc nameCacheFromGhc = ( read_from_session , write_to_session ) where @@ -154,6 +147,16 @@ nameCacheFromGhc = ( read_from_session , write_to_session ) write_to_session nc' = do ref <- withSession (return . hsc_NC) liftIO $ writeIORef ref nc' +#else +nameCacheFromGhc :: Session -> NameCacheAccessor IO +nameCacheFromGhc session = ( read_from_session , write_to_session ) + where + read_from_session = readIORef . hsc_NC =<< sessionHscEnv session + write_to_session nc' = do + ref <- liftM hsc_NC $ sessionHscEnv session + writeIORef ref nc' +#endif + freshNameCache :: NameCacheAccessor IO freshNameCache = ( create_fresh_nc , \_ -> return () ) |