Update examples

This commit is contained in:
Don Stewart
2005-09-03 04:45:14 +00:00
parent 5321754614
commit dff0363224
421 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,3 @@
module A where
a = "a"

View File

@ -0,0 +1,3 @@
module B where
b = "b"

View File

@ -0,0 +1,3 @@
module C where
c = "c"

View File

@ -0,0 +1,3 @@
TEST= make/makeall001
TOP=../../..
include ../../build.mk

View File

@ -0,0 +1,13 @@
module Tiny ( resource ) where
import API
import A
import B
import C
resource = tiny {
field = a ++ b ++ c
}

View 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" }

View 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

View File

@ -0,0 +1 @@
abc