Commit fbb68f1d authored by mnislaih's avatar mnislaih

Remove uses of Data.Traversable to fix stage1 on pre ghc-6.6 systems

parent 7ef63167
......@@ -38,12 +38,12 @@ import ErrUtils
import FastString
import SrcLoc
import Util
import Maybes
import Control.Exception
import Control.Monad
import qualified Data.Map as Map
import Data.Array.Unboxed
import Data.Traversable ( traverse )
import Data.Typeable ( Typeable )
import Data.Maybe
import Data.IORef
......@@ -77,9 +77,9 @@ pprintClosureCommand bindThings force str = do
-- Give names to suspensions and bind them in the local env
mb_terms' <- if bindThings
then io$ mapM (traverse (bindSuspensions cms)) mb_terms
then io$ mapM (fmapMMaybe (bindSuspensions cms)) mb_terms
else return mb_terms
ppr_terms <- io$ mapM (traverse (printTerm cms)) mb_terms'
ppr_terms <- io$ mapM (fmapMMaybe (printTerm cms)) mb_terms'
let docs = [ ppr id <+> char '=' <+> t | (Just t,id) <- zip ppr_terms ids]
unqual <- io$ GHC.getPrintUnqual cms
io . putStrLn . showSDocForUser unqual $ Outputable.vcat docs
......
......@@ -76,6 +76,7 @@ import TysWiredIn
import Constants ( wORD_SIZE )
import FastString ( mkFastString )
import Outputable
import Maybes
import Panic
import GHC.Arr ( Array(..) )
......@@ -87,13 +88,10 @@ import GHC.Word ( Word32(..), Word64(..) )
import Control.Monad ( liftM, liftM2, msum )
import Data.Maybe
import Data.List
import Data.Traversable ( mapM )
import Data.Array.Base
import Foreign.Storable
import Foreign ( unsafePerformIO )
import Prelude hiding ( mapM )
---------------------------------------------
-- * A representation of semi evaluated Terms
---------------------------------------------
......@@ -546,7 +544,7 @@ zonkTerm = foldTerm idTermFoldM {
fTerm = \ty dc v tt -> sequence tt >>= \tt ->
zonkTcType ty >>= \ty' ->
return (Term ty' dc v tt)
,fSuspension = \ct ty v b -> mapM zonkTcType ty >>= \ty ->
,fSuspension = \ct ty v b -> fmapMMaybe zonkTcType ty >>= \ty ->
return (Suspension ct ty v b)}
{-
......
......@@ -280,7 +280,6 @@ import System.Exit ( exitWith, ExitCode(..) )
import System.Time ( ClockTime )
import Control.Exception as Exception hiding (handle)
import Data.IORef
import Data.Traversable ( traverse )
import System.IO
import System.IO.Error ( isDoesNotExistError )
import Prelude hiding (init)
......
......@@ -17,7 +17,7 @@ module Maybes (
expectJust,
maybeToBool,
thenMaybe, seqMaybe, returnMaybe, failMaybe
thenMaybe, seqMaybe, returnMaybe, failMaybe, fmapMMaybe
) where
#include "HsVersions.h"
......@@ -100,6 +100,11 @@ failMaybe = Nothing
orElse :: Maybe a -> a -> a
(Just x) `orElse` y = x
Nothing `orElse` y = y
fmapMMaybe :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b)
fmapMMaybe f Nothing = return Nothing
fmapMMaybe f (Just x) = f x >>= \x' -> return (Just x')
\end{code}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment