Compatibility with GHC 8.2.1

This commit is contained in:
Ben Gamari
2017-08-19 17:27:08 -04:00
parent 3d9a339869
commit d00e956e4a
10 changed files with 102 additions and 17 deletions

View File

@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}
module GhcMod.Exe.Test where
import Control.Applicative
@@ -36,6 +38,15 @@ test f = runGmlT' [Left f] (fmap setHscInterpreted . deferErrors) $ do
return ""
#if __GLASGOW_HASKELL__ >= 802
runTest :: GhcMonad m => String -> m (Maybe SomeException)
runTest fn = do
res <- execStmt ("quickCheck " ++ fn) execOptions
return $ case res of
ExecComplete (Right _) _ -> Nothing
ExecComplete (Left se) _ -> Just se
_ -> error "runTest"
#else
runTest :: GhcMonad m => String -> m (Maybe SomeException)
runTest fn = do
res <- runStmt ("quickCheck " ++ fn) RunToCompletion
@@ -43,3 +54,4 @@ runTest fn = do
RunOk [] -> Nothing
RunException se -> Just se
_ -> error "runTest"
#endif