Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't build with recent versions of base #1

Open
phlummox opened this issue Jul 29, 2020 · 0 comments
Open

Doesn't build with recent versions of base #1

phlummox opened this issue Jul 29, 2020 · 0 comments

Comments

@phlummox
Copy link

Not sure if you prefer to track issues here or on Bitbucket - I see hackage does list Bitbucket as the official repository, but also that neither repo has been touched in a long while.

At any rate: global-variables isn’t compatible with versions of base since 4.9, due to changes in the API for Data.Typeable.

Three lines need to be patched in order to make it work:

diff --git a/src/Data/Global/Registry.hs b/src/Data/Global/Registry.hs
index e7591ce..d29f2c7 100644
--- a/src/Data/Global/Registry.hs
+++ b/src/Data/Global/Registry.hs
@@ -30,6 +30,7 @@ import Control.Exception       ( evaluate )
 #endif
 import Data.IORef
 import Data.Dynamic
+import Data.Typeable
 import Data.Map as M
 import GHC.Conc                ( pseq )
 import GHC.IO                  ( unsafePerformIO, unsafeDupablePerformIO )
@@ -63,7 +64,7 @@ globalRegistry = m `pseq` unsafePerformIO (newMVar m)

 -- | Exposed for unit testing
 lookupOrInsert
-    :: forall a. forall ref. (Typeable a, Typeable1 ref)
+    :: forall a  ref . (Typeable a, Typeable ref)
     => MVar Registry
     -> (a -> IO (ref a))
     -> String
@@ -79,7 +80,7 @@ lookupOrInsert registry new name val = modifyMVar registry lkup

 #if __GLASGOW_HASKELL__ >= 702
     typVal = typeOf val
-    typRef = typeOf (undefined :: ref ()) -- TypeRep representing the reference, e.g. IORef,
+    typRef = typeOf1 (undefined :: ref ()) -- TypeRep representing the reference, e.g. IORef,
                                           -- MVar

     lkup :: Registry -> IO (Registry, ref a)

I'd be happy to create a pull request if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant