Update examples
This commit is contained in:
3
testsuite/make/makeall001/A.hs
Normal file
3
testsuite/make/makeall001/A.hs
Normal file
@ -0,0 +1,3 @@
|
||||
module A where
|
||||
|
||||
a = "a"
|
3
testsuite/make/makeall001/B.hs
Normal file
3
testsuite/make/makeall001/B.hs
Normal file
@ -0,0 +1,3 @@
|
||||
module B where
|
||||
|
||||
b = "b"
|
3
testsuite/make/makeall001/C.hs
Normal file
3
testsuite/make/makeall001/C.hs
Normal file
@ -0,0 +1,3 @@
|
||||
module C where
|
||||
|
||||
c = "c"
|
3
testsuite/make/makeall001/Makefile
Normal file
3
testsuite/make/makeall001/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
TEST= make/makeall001
|
||||
TOP=../../..
|
||||
include ../../build.mk
|
13
testsuite/make/makeall001/Tiny.hs
Normal file
13
testsuite/make/makeall001/Tiny.hs
Normal file
@ -0,0 +1,13 @@
|
||||
module Tiny ( resource ) where
|
||||
|
||||
import API
|
||||
|
||||
import A
|
||||
import B
|
||||
import C
|
||||
|
||||
resource = tiny {
|
||||
|
||||
field = a ++ b ++ c
|
||||
|
||||
}
|
13
testsuite/make/makeall001/api/API.hs
Normal file
13
testsuite/make/makeall001/api/API.hs
Normal file
@ -0,0 +1,13 @@
|
||||
{-# OPTIONS -fglasgow-exts #-}
|
||||
-- ^ needed to derive Typeable
|
||||
|
||||
module API where
|
||||
|
||||
import Data.Dynamic
|
||||
|
||||
data Tiny = Tiny { field :: String }
|
||||
deriving (Typeable, Show)
|
||||
|
||||
tiny :: Tiny
|
||||
tiny = Tiny { field = "default value" }
|
||||
|
18
testsuite/make/makeall001/prog/Main.hs
Normal file
18
testsuite/make/makeall001/prog/Main.hs
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
-- little more complex. use the path to the obj file we get back from
|
||||
-- 'make'. load() uses this to find the .hi file
|
||||
|
||||
import System.Plugins
|
||||
import API
|
||||
|
||||
main = do
|
||||
status <- makeAll "../Tiny.hs" ["-i../api"]
|
||||
o <- case status of
|
||||
MakeSuccess _ o -> return o
|
||||
MakeFailure e -> mapM_ putStrLn e >> error "failed"
|
||||
m_v <- load o [".."] [] "resource"
|
||||
v <- case m_v of
|
||||
LoadSuccess _ v -> return v
|
||||
_ -> error "load failed"
|
||||
putStrLn $ field v
|
||||
|
1
testsuite/make/makeall001/prog/expected
Normal file
1
testsuite/make/makeall001/prog/expected
Normal file
@ -0,0 +1 @@
|
||||
abc
|
Reference in New Issue
Block a user