This instance requires the inner type to
be a monad instead of a functor.

This Instance definition is necessary in
ghc 7.6.x because many instance definitions
of ResultT assume ResultT to be a functor if
the inner type is a monad.

Signed-off-by: Bhimanavajjula Aditya <[email protected]>
---
 src/Ganeti/BasicTypes.hs |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Ganeti/BasicTypes.hs b/src/Ganeti/BasicTypes.hs
index 2347b5a..5d03f32 100644
--- a/src/Ganeti/BasicTypes.hs
+++ b/src/Ganeti/BasicTypes.hs
@@ -172,7 +172,6 @@ instance Applicative (GenericResult a) where
 -- If 'mplus' combines two failing operations, errors of both of them
 -- are combined.
 newtype ResultT a m b = ResultT {runResultT :: m (GenericResult a b)}
-  deriving (Functor)
 
 -- | Eliminates a 'ResultT' value given appropriate continuations
 elimResultT :: (Monad m)
@@ -186,6 +185,9 @@ elimResultT l r = ResultT . (runResultT . result <=< 
runResultT)
     result (Bad e)  = l e
 {-# INLINE elimResultT #-}
 
+instance (Monad m) => Functor (ResultT a m) where
+  fmap f = ResultT . liftM (fmap f) . runResultT
+
 instance (Monad m, FromString a) => Applicative (ResultT a m) where
   pure = return
   (<*>) = ap
-- 
1.7.10.4

Reply via email to