De-orphan the MonadFix ST instance for GHC
authorIan Lynagh <igloo@earth.li>
Mon, 23 Nov 2009 22:35:44 +0000 (22:35 +0000)
committerIan Lynagh <igloo@earth.li>
Mon, 23 Nov 2009 22:35:44 +0000 (22:35 +0000)
Control/Monad/Fix.hs
Control/Monad/ST.hs

index c1b4fe1..57308bf 100644 (file)
@@ -29,6 +29,9 @@ import Data.Function (fix)
 #ifdef __HUGS__
 import Hugs.Prelude (MonadFix(mfix))
 #endif
+#if defined(__GLASGOW_HASKELL__)
+import GHC.ST
+#endif
 
 #ifndef __HUGS__
 -- | Monads having fixed points with a \'knot-tying\' semantics.
@@ -77,3 +80,9 @@ instance MonadFix IO where
 
 instance MonadFix ((->) r) where
     mfix f = \ r -> let a = f a r in a
+
+#if defined(__GLASGOW_HASKELL__)
+instance MonadFix (ST s) where
+        mfix = fixST
+#endif
+
index 3ce5001..8ebb750 100644 (file)
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-orphans #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Control.Monad.ST
@@ -32,7 +31,11 @@ module Control.Monad.ST
         unsafeSTToIO            -- :: ST s a -> IO a
       ) where
 
+#if defined(__GLASGOW_HASKELL__)
+import Control.Monad.Fix ()
+#else
 import Control.Monad.Fix
+#endif
 
 #include "Typeable.h"
 
@@ -58,6 +61,8 @@ unsafeInterleaveST =
     LazyST.lazyToStrictST . LazyST.unsafeInterleaveST . LazyST.strictToLazyST
 #endif
 
+#if !defined(__GLASGOW_HASKELL__)
 instance MonadFix (ST s) where
         mfix = fixST
+#endif