Import hs-plugins cvs
This commit is contained in:
8
examples/load/thiemann2/prog/A.hs
Normal file
8
examples/load/thiemann2/prog/A.hs
Normal file
@ -0,0 +1,8 @@
|
||||
module A where
|
||||
|
||||
import API
|
||||
|
||||
import qualified B
|
||||
|
||||
resource = Test { field = B.resource }
|
||||
|
3
examples/load/thiemann2/prog/B.hs
Normal file
3
examples/load/thiemann2/prog/B.hs
Normal file
@ -0,0 +1,3 @@
|
||||
module B where
|
||||
|
||||
resource = "i'm in b"
|
20
examples/load/thiemann2/prog/Main.hs
Normal file
20
examples/load/thiemann2/prog/Main.hs
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
import Plugins
|
||||
import API
|
||||
|
||||
import A
|
||||
|
||||
main = do
|
||||
-- compile C (A and B are already compiled)
|
||||
status <- makeAll "../C.hs" ["-i../api"]
|
||||
obj <- case status of
|
||||
MakeSuccess _ o -> return o
|
||||
MakeFailure e -> mapM_ putStrLn e >> error "failed"
|
||||
|
||||
-- should load C
|
||||
m_v <- load_ obj ["../api","."] "resource"
|
||||
v <- case m_v of
|
||||
LoadFailure _ -> error "load failed"
|
||||
LoadSuccess _ v -> return v
|
||||
let s = field v
|
||||
print s
|
1
examples/load/thiemann2/prog/expected
Normal file
1
examples/load/thiemann2/prog/expected
Normal file
@ -0,0 +1 @@
|
||||
"i'm in b"
|
Reference in New Issue
Block a user