Fixes for GHC 8.x, archive loading, -dynamic, and file generation
This commit is contained in:
6
testsuite/load/plain/Makefile
Normal file
6
testsuite/load/plain/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
TEST=load/plain
|
||||
|
||||
EXTRA_OBJS=TestIO.o
|
||||
|
||||
TOP=../../..
|
||||
include ../../build.mk
|
11
testsuite/load/plain/TestIO.hs
Normal file
11
testsuite/load/plain/TestIO.hs
Normal file
@ -0,0 +1,11 @@
|
||||
module TestIO (resource) where
|
||||
|
||||
import Control.Monad (forever)
|
||||
|
||||
import API
|
||||
|
||||
resource :: CLIInterface
|
||||
resource = testio { repl = loop }
|
||||
|
||||
loop :: IO ()
|
||||
loop = forever $ getLine >>= putStrLn
|
10
testsuite/load/plain/api/API.hs
Normal file
10
testsuite/load/plain/api/API.hs
Normal file
@ -0,0 +1,10 @@
|
||||
module API(CLIInterface(..), testio) where
|
||||
|
||||
import Data.Typeable
|
||||
|
||||
data CLIInterface = CLIInterface {
|
||||
repl :: IO ()
|
||||
} deriving Typeable
|
||||
|
||||
testio :: CLIInterface
|
||||
testio = CLIInterface { repl = return () }
|
22
testsuite/load/plain/prog/Main.hs
Normal file
22
testsuite/load/plain/prog/Main.hs
Normal file
@ -0,0 +1,22 @@
|
||||
module Main (main) where
|
||||
|
||||
import Control.Exception (handle)
|
||||
|
||||
import System.Plugins
|
||||
|
||||
import API
|
||||
|
||||
fexn :: IOError -> IO ()
|
||||
fexn = print
|
||||
|
||||
main :: IO ()
|
||||
main = handle fexn $ do
|
||||
mf <- load "../TestIO.o" ["../api"] [] "resource"
|
||||
case mf of
|
||||
LoadFailure _ -> error "nope"
|
||||
LoadSuccess _ v -> do
|
||||
putStrLn "success"
|
||||
engage v
|
||||
|
||||
engage :: CLIInterface -> IO ()
|
||||
engage plugin = repl plugin
|
Reference in New Issue
Block a user