@@ -146,15 +146,17 @@ module Control.Parallel.Strategies (
146146    NFData 
147147  ) where 
148148
149- #if  !MIN_VERSION_base(4,8,0)
149+ #if  defined(__MHS__) ||  !MIN_VERSION_base(4,8,0)
150150import  Data.Traversable 
151+ #endif 
152+ #if  !MIN_VERSION_base(4,8,0)
151153import  Control.Applicative 
152154#endif 
153155import  Control.Parallel 
154156import  Control.DeepSeq  (NFData (rnf ))
155157import  Control.Monad.Fix  (MonadFix  (.. ))
156158
157- #if  MIN_VERSION_base(4,4,0)
159+ #if  defined(__GLASGOW_HASKELL__) &&  MIN_VERSION_base(4,4,0)
158160import  System.IO.Unsafe  (unsafeDupablePerformIO )
159161import  Control.Exception  (evaluate )
160162#else 
@@ -164,8 +166,10 @@ import Control.Monad
164166
165167import  qualified  Control.Seq 
166168
169+ #ifdef  __GLASGOW_HASKELL__
167170import  GHC.Exts 
168171import  GHC.IO  (IO .. ))
172+ #endif 
169173
170174infixr  9  `dot`      --  same as (.)
171175infixl  0  `using`    --  lowest precedence and associate to the left
@@ -280,7 +284,11 @@ instance Applicative Eval where
280284
281285instance  Monad Eval  where 
282286  return  =  pure 
287+ #  ifdef __GLASGOW_HASKELL__
283288  Done  x >>=  k =  lazy (k x)   --  Note: pattern 'Done x' makes '>>=' strict
289+ #  else
290+   Done  x >>=  k =  k x
291+ #  endif
284292
285293instance  MonadFix  Eval  where 
286294  mfix f =  let  r =  f (runEval r) in  r
@@ -463,10 +471,14 @@ rdeepseq x = do rseq (rnf x); return x
463471
464472--  |  'rpar' sparks its argument (for evaluation in parallel). 
465473rpar  ::  Strategy  a 
474+ #ifdef  __GLASGOW_HASKELL__
466475#if  __GLASGOW_HASKELL__ >= 702
467- rpar  x =  Eval  $  IO  $  \ s ->  spark#  x s
476+ rpar x =  Eval  $  IO  $  \ s ->  spark#  x s
477+ #else 
478+ rpar x =  case  (par#  x) of  _ ->  Done  x
479+ #endif 
468480#else 
469- rpar   x =  case  ( par#  x ) of  { _  ->  Done  x } 
481+ rpar x =  case  par x  ( )of  ()   ->  Done  x
470482#endif 
471483{-# INLINE  rpar  #-}
472484
0 commit comments