Commits (3)
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module CrossCodegen where
......@@ -28,9 +27,7 @@ import System.Directory (removeFile)
import Data.Char (toLower,toUpper,isSpace)
import Control.Exception (assert, onException)
import Control.Monad (when, liftM, forM, ap)
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative (Applicative(..))
#endif
import Control.Applicative as AP (Applicative(..))
import Data.Foldable (concatMap)
import Data.Maybe (fromMaybe)
import qualified Data.Sequence as S
......@@ -52,11 +49,11 @@ instance Functor TestMonad where
fmap = liftM
instance Applicative TestMonad where
pure = return
pure a = TestMonad (\_ c -> pure (Right a, c))
(<*>) = ap
instance Monad TestMonad where
return a = TestMonad (\_ c -> return $ (Right a, c))
return = AP.pure
x >>= fn = TestMonad (\e c -> (runTest x e c) >>=
(\(a,c') -> either (\err -> return (Left err, c'))
(\result -> runTest (fn result) e c')
......@@ -563,12 +560,7 @@ runCompileTest testStr = do
runCompiler :: FilePath -> [String] -> Maybe FilePath -> TestMonad Bool
runCompiler prog args mStdoutFile = do
let cmdLine =
#if MIN_VERSION_process(1,1,0)
showCommandForUser prog args
#else
unwords (prog : args)
#endif
let cmdLine = showCommandForUser prog args
testLog ("executing: " ++ cmdLine) $ liftTestIO $ do
mHOut <- case mStdoutFile of
Nothing -> return Nothing
......
......@@ -25,11 +25,11 @@ instance Functor Parser where
fmap = liftM
instance Applicative Parser where
pure = return
pure a = Parser $ \pos s -> Success pos [] s a
(<*>) = ap
instance Monad Parser where
return a = Parser $ \pos s -> Success pos [] s a
return = pure
Parser m >>= k =
Parser $ \pos s -> case m pos s of
Success pos' out1 s' a -> case k a of
......
......@@ -40,5 +40,5 @@ Executable hsc2hs
containers >= 0.2 && < 0.6,
directory >= 1 && < 1.3,
filepath >= 1 && < 1.5,
process >= 1 && < 1.3
process >= 1.1 && < 1.4