Update examples
This commit is contained in:
20
testsuite/makewith/unsafeio/prog/Main.hs
Normal file
20
testsuite/makewith/unsafeio/prog/Main.hs
Normal file
@ -0,0 +1,20 @@
|
||||
import System.Plugins
|
||||
import API
|
||||
import Data.Either
|
||||
|
||||
conf = "../Unsafe.conf"
|
||||
stub = "../Unsafe.stub"
|
||||
apipath = "../api"
|
||||
|
||||
main = do
|
||||
status <- makeWith conf stub ["-i"++apipath]
|
||||
o <- case status of
|
||||
MakeFailure e -> mapM_ putStrLn e >> error "failed"
|
||||
MakeSuccess _ o -> return o
|
||||
m_v <- load o [apipath] [] "resource"
|
||||
v <- case m_v of
|
||||
LoadSuccess _ v -> return v
|
||||
_ -> error "load failed"
|
||||
let s = field v
|
||||
makeCleaner o
|
||||
if null s then print False else print True
|
8
testsuite/makewith/unsafeio/prog/README
Normal file
8
testsuite/makewith/unsafeio/prog/README
Normal file
@ -0,0 +1,8 @@
|
||||
this is an example of an application that uses the HSConf library to
|
||||
dynamically load compiled conf files.
|
||||
|
||||
We use the .conf file in the parent directory, and communicate with
|
||||
the plugin via the API in the api_package/ directory.
|
||||
|
||||
The plugin is a .o file
|
||||
The api is a GHC package archive
|
6
testsuite/makewith/unsafeio/prog/expected
Normal file
6
testsuite/makewith/unsafeio/prog/expected
Normal file
@ -0,0 +1,6 @@
|
||||
merge failed:
|
||||
|
||||
parse error in ../Unsafe.conf
|
||||
line: 13, col: 1
|
||||
|
||||
a.out: failed
|
Reference in New Issue
Block a user