[Pkg-ganeti-devel] [ganeti] 90/165: Change the instance definition of MetadMonadInt to

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Aug 11 13:53:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit 18bd06cd537fa94ea94487ec36414c702486ac7c
Author: BSRK Aditya <bsrk at google.com>
Date:   Fri Mar 20 15:53:31 2015 +0100

    Change the instance definition of MetadMonadInt to
    
    also support monad-control 1.0.0.x
    
    Signed-off-by: BSRK Aditya <bsrk at google.com>
    Signed-off-by: Petr Pudlak <pudlak at google.com>
    Reviewed-by: Petr Pudlak <pudlak at google.com>
---
 src/Ganeti/Metad/ConfigCore.hs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/Metad/ConfigCore.hs b/src/Ganeti/Metad/ConfigCore.hs
index 6d3295e..41120fd 100644
--- a/src/Ganeti/Metad/ConfigCore.hs
+++ b/src/Ganeti/Metad/ConfigCore.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TupleSections, TemplateHaskell,
+{-# LANGUAGE TupleSections, TemplateHaskell, CPP, UndecidableInstances,
     MultiParamTypeClasses, TypeFamilies, GeneralizedNewtypeDeriving #-}
 {-| Functions of the metadata daemon exported for RPC
 
@@ -37,7 +37,6 @@ module Ganeti.Metad.ConfigCore where
 
 import Control.Applicative
 import Control.Concurrent.MVar.Lifted
-import Control.Monad
 import Control.Monad.Base
 import Control.Monad.IO.Class
 import Control.Monad.Reader
@@ -69,11 +68,19 @@ newtype MetadMonadInt a = MetadMonadInt
            , L.MonadLog )
 
 instance MonadBaseControl IO MetadMonadInt where
+#if MIN_VERSION_monad_control(1,0,0)
+-- Needs Undecidable instances
+  type StM MetadMonadInt b = StM MetadMonadIntType b
+  liftBaseWith f = MetadMonadInt . liftBaseWith
+                   $ \r -> f (r . getMetadMonadInt)
+  restoreM = MetadMonadInt . restoreM
+#else
   newtype StM MetadMonadInt b = StMMetadMonadInt
     { runStMMetadMonadInt :: StM MetadMonadIntType b }
   liftBaseWith f = MetadMonadInt . liftBaseWith
                    $ \r -> f (liftM StMMetadMonadInt . r . getMetadMonadInt)
   restoreM = MetadMonadInt . restoreM . runStMMetadMonadInt
+#endif
 
 -- | Runs the internal part of the MetadMonad monad on a given daemon
 -- handle.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list