prog003.script 1.64 KB
Newer Older
1 2
:unset +s
:unset +t
3
-- A small multi-module program, with 4 modules, A, B, C, D.  B & C
4 5 6 7 8 9
-- depend on D, and A depends on B & C.
-- 
-- This test will try various combinations of compiled and interpreted
-- versions of each module, and make sure each combination behaves
-- sensibly.

Simon Marlow's avatar
Simon Marlow committed
10 11 12
:l ../shell.hs
:def shell (\s -> do shell s; return "")

13
-- clean up
Simon Marlow's avatar
Simon Marlow committed
14 15
:shell rm -f *.o *.hi
:shell cp D1.hs D.hs
16

Ian Lynagh's avatar
Ian Lynagh committed
17
putStrLn "Run 1"
18 19 20 21
:load A
:type a
a 42

Ian Lynagh's avatar
Ian Lynagh committed
22
putStrLn "Run 2"
23
-- sigh; sleep 1, because the filesystem only stores times in seconds
Simon Marlow's avatar
Simon Marlow committed
24
:shell sleep 1; cp D2.hs D.hs
25
:reload
26
:type (A.a,B.b,C.c,D.d)
27 28
a 42

Ian Lynagh's avatar
Ian Lynagh committed
29
putStrLn "Run 3"
30
-- compile D, check that :reload doesn't pick it up
ian@well-typed.com's avatar
ian@well-typed.com committed
31
:shell "$HC" $HC_OPTS $ghciWayFlags -c D.hs
32
:reload
33
:type (A.a,B.b,C.c,D.d)
34 35
a 42

Ian Lynagh's avatar
Ian Lynagh committed
36
putStrLn "Run 4"
37 38
-- pick up the compiled D now, with :load
:load A
39
:type (A.a,B.b,C.c,D.d)
40 41
a 42

Ian Lynagh's avatar
Ian Lynagh committed
42
putStrLn "Run 5"
43
-- D,C compiled
ian@well-typed.com's avatar
ian@well-typed.com committed
44
:shell "$HC" $HC_OPTS $ghciWayFlags -c C.hs
45
:load A
46
:type (A.a,B.b,C.c,D.d)
47 48
a 42

Ian Lynagh's avatar
Ian Lynagh committed
49
putStrLn "Run 6"
50
-- D,C,B compiled
ian@well-typed.com's avatar
ian@well-typed.com committed
51
:shell "$HC" $HC_OPTS $ghciWayFlags -c B.hs
52
:load A
53
:type (A.a,B.b,C.c,D.d)
54 55
a 42

Ian Lynagh's avatar
Ian Lynagh committed
56
putStrLn "Run 7"
57
-- D,C,B,A compiled
ian@well-typed.com's avatar
ian@well-typed.com committed
58
:shell "$HC" $HC_OPTS $ghciWayFlags -c A.hs
59
:load A
60
:type (A.a,B.b,C.c,D.d)
61 62
a 42

Ian Lynagh's avatar
Ian Lynagh committed
63
putStrLn "Run 8"
64
-- D,C,A compiled  (better not use A.o)
Simon Marlow's avatar
Simon Marlow committed
65
:shell rm B.o
66
:load A
67
:type (A.a,B.b,C.c,D.d)
68 69
a 42

Ian Lynagh's avatar
Ian Lynagh committed
70
putStrLn "Run 9"
71
-- D,A compiled  (better not use A.o)
Simon Marlow's avatar
Simon Marlow committed
72
:shell rm C.o
73
:load A
74
:type (A.a,B.b,C.c,D.d)
75 76
a 42

Ian Lynagh's avatar
Ian Lynagh committed
77
putStrLn "Run 10"
78
-- A compiled  (better not use A.o)
Simon Marlow's avatar
Simon Marlow committed
79
:shell rm D.o
80
:load A
81
:type (A.a,B.b,C.c,D.d)
82 83
a 42

Ian Lynagh's avatar
Ian Lynagh committed
84
putStrLn "Run 11"
85
-- A,B,C compiled (better not use A.o, B.o, C.o)
ian@well-typed.com's avatar
ian@well-typed.com committed
86
:shell "$HC" $HC_OPTS $ghciWayFlags --make -v0 A
Simon Marlow's avatar
Simon Marlow committed
87
:shell rm D.o
88
:load A
89
:type (A.a,B.b,C.c,D.d)
90
a 42