From: simonmar Date: Thu, 1 Mar 2001 15:36:21 +0000 (+0000) Subject: [project @ 2001-03-01 15:36:20 by simonmar] X-Git-Tag: Approximately_9120_patches~2502 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b3834c593ad679f9b2995d470589c8e7ee6c7542;p=ghc-hetmet.git [project @ 2001-03-01 15:36:20 by simonmar] The beginnings of a GHCi test suite. --- diff --git a/ghc/tests/ghci/Makefile b/ghc/tests/ghci/Makefile new file mode 100644 index 0000000..0af21c6 --- /dev/null +++ b/ghc/tests/ghci/Makefile @@ -0,0 +1,9 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 2001/03/01 15:36:20 simonmar Exp $ + +TOP = .. +include $(TOP)/mk/boilerplate.mk + +SUBDIRS=$(wildcard prog*/) + +include $(TOP)/mk/ghci.mk diff --git a/ghc/tests/ghci/ghci001.script b/ghc/tests/ghci/ghci001.script new file mode 100644 index 0000000..0902a0c --- /dev/null +++ b/ghc/tests/ghci/ghci001.script @@ -0,0 +1,3 @@ +-- bug: shouldn't be defaulting these expressions +:type (+) +:type enumFromTo diff --git a/ghc/tests/ghci/ghci002.script b/ghc/tests/ghci/ghci002.script new file mode 100644 index 0000000..a943f77 --- /dev/null +++ b/ghc/tests/ghci/ghci002.script @@ -0,0 +1,4 @@ +-- bug: we used to throw away the instance accidentally here +:m PrelBase +1 == (2 :: Int) +1 == (2 :: Int) diff --git a/ghc/tests/ghci/ghci002.stdout b/ghc/tests/ghci/ghci002.stdout new file mode 100644 index 0000000..f34f092 --- /dev/null +++ b/ghc/tests/ghci/ghci002.stdout @@ -0,0 +1,14 @@ + ___ ___ _ + / _ \ /\ /\/ __(_) + / /_\// /_/ / / | | GHC Interactive, version 4.11, For Haskell 98. +/ /_\\/ __ / /___| | http://www.haskell.org/ghc/ +\____/\/ /_/\____/|_| Type :? for help. + +Loading package std ... linking ... done. +Prelude> -- bug: we used to throw away the instance accidentally here +Prelude> :m PrelBase +PrelBase> 1 == (2 :: Int) +False +PrelBase> 1 == (2 :: Int) +False +PrelBase> Leaving GHCi. diff --git a/ghc/tests/ghci/prog001/A.hs b/ghc/tests/ghci/prog001/A.hs new file mode 100644 index 0000000..ca0a7e8 --- /dev/null +++ b/ghc/tests/ghci/prog001/A.hs @@ -0,0 +1,5 @@ +module Main where + +import B + +main = print ("hello world" ++ show (f 42)) diff --git a/ghc/tests/ghci/prog001/B.hs b/ghc/tests/ghci/prog001/B.hs new file mode 100644 index 0000000..e57c31f --- /dev/null +++ b/ghc/tests/ghci/prog001/B.hs @@ -0,0 +1,5 @@ +module B (module B, module C) where + +import C + +k x = x `mod` 11 diff --git a/ghc/tests/ghci/prog001/C.hs b/ghc/tests/ghci/prog001/C.hs new file mode 100644 index 0000000..b602f28 --- /dev/null +++ b/ghc/tests/ghci/prog001/C.hs @@ -0,0 +1,7 @@ +module C (f, g, h) where + +import D + +g x = f x + 1 + +h x = x `div` 2 diff --git a/ghc/tests/ghci/prog001/D.hs b/ghc/tests/ghci/prog001/D.hs new file mode 100644 index 0000000..997171c --- /dev/null +++ b/ghc/tests/ghci/prog001/D.hs @@ -0,0 +1,5 @@ +module D where + +data T = A Int | B Float deriving Eq + +f x = x + 1 diff --git a/ghc/tests/ghci/prog001/D1.hs b/ghc/tests/ghci/prog001/D1.hs new file mode 100644 index 0000000..35184c7 --- /dev/null +++ b/ghc/tests/ghci/prog001/D1.hs @@ -0,0 +1,5 @@ +module D where + +data T = A Int | B Float deriving Eq + +f x = x + x diff --git a/ghc/tests/ghci/prog001/D2.hs b/ghc/tests/ghci/prog001/D2.hs new file mode 100644 index 0000000..997171c --- /dev/null +++ b/ghc/tests/ghci/prog001/D2.hs @@ -0,0 +1,5 @@ +module D where + +data T = A Int | B Float deriving Eq + +f x = x + 1 diff --git a/ghc/tests/ghci/prog001/Makefile b/ghc/tests/ghci/prog001/Makefile new file mode 100644 index 0000000..fd68eaf --- /dev/null +++ b/ghc/tests/ghci/prog001/Makefile @@ -0,0 +1,7 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 2001/03/01 15:36:20 simonmar Exp $ + +TOP = ../.. +include $(TOP)/mk/boilerplate.mk + +include $(TOP)/mk/ghci.mk diff --git a/ghc/tests/ghci/prog001/prog001.script b/ghc/tests/ghci/prog001/prog001.script new file mode 100644 index 0000000..7a1810c --- /dev/null +++ b/ghc/tests/ghci/prog001/prog001.script @@ -0,0 +1,35 @@ +-- first, tidy up: +:unset +s +:! rm -f *.hi *.o *~ +:! cp D1.hs D.hs + +-- load the program (all interpreted) +:load A + +-- reloading should do nothing +:reload + +-- make sure `main' works +main + +-- touch a module + recompile +:! touch C.hs +:reload + +-- make sure `main' still works +main + +-- compile D & reload +:! $HC $HC_OPTS -no-recomp -c D.hs +:reload +main + +-- change A, recompile & reload +:! cp D2.hs D.hs +:! $HC $HC_OPTS -no-recomp -c D.hs +:reload +:load A + +-- make sure we're picking up the new D, via B +:module B +g 42 diff --git a/ghc/tests/ghci/prog001/prog001.stderr b/ghc/tests/ghci/prog001/prog001.stderr new file mode 100644 index 0000000..78d36fb --- /dev/null +++ b/ghc/tests/ghci/prog001/prog001.stderr @@ -0,0 +1,13 @@ +Compiling D (D.hs) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +Compiling D (D.hs) +Skipping C (C.hs) +Skipping B (B.hs) +Skipping Main (A.hs) +Skipping D (D.hs) + (using D.o) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) diff --git a/ghc/tests/ghci/prog001/prog001.stdout b/ghc/tests/ghci/prog001/prog001.stdout new file mode 100644 index 0000000..521f1d6 --- /dev/null +++ b/ghc/tests/ghci/prog001/prog001.stdout @@ -0,0 +1,53 @@ + ___ ___ _ + / _ \ /\ /\/ __(_) + / /_\// /_/ / / | | GHC Interactive, version 4.11, For Haskell 98. +/ /_\\/ __ / /___| | http://www.haskell.org/ghc/ +\____/\/ /_/\____/|_| Type :? for help. + +Loading package std ... linking ... done. +Prelude> -- first, tidy up: +Prelude> :unset +s +Prelude> :! rm -f *.hi *.o *~ +Prelude> :! cp D1.hs D.hs +Prelude> +Prelude> -- load the program (all interpreted) +Prelude> :load A +Ok, modules loaded: Main, B, C, D. +Main> +Main> -- reloading should do nothing +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> +Main> -- make sure `main' works +Main> main +"hello world84" +Main> +Main> -- touch a module + recompile +Main> :! touch C.hs +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> +Main> -- make sure `main' still works +Main> main +"hello world84" +Main> +Main> -- compile D & reload +Main> :! $HC $HC_OPTS -no-recomp -c D.hs +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> main +"hello world84" +Main> +Main> -- change A, recompile & reload +Main> :! cp D2.hs D.hs +Main> :! $HC $HC_OPTS -no-recomp -c D.hs +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> +Main> -- make sure we're picking up the new D, via B +Main> :module B +B> g 42 +44 +B> Leaving GHCi. diff --git a/ghc/tests/ghci/prog002/A.hs b/ghc/tests/ghci/prog002/A.hs new file mode 100644 index 0000000..6dc493a --- /dev/null +++ b/ghc/tests/ghci/prog002/A.hs @@ -0,0 +1,6 @@ +module A where + +data T = A Int | B Float deriving Eq + +f :: Int -> Int +f x = x + 3 diff --git a/ghc/tests/ghci/prog002/A1.hs b/ghc/tests/ghci/prog002/A1.hs new file mode 100644 index 0000000..069e8ef --- /dev/null +++ b/ghc/tests/ghci/prog002/A1.hs @@ -0,0 +1,6 @@ +module A where + +data T = A Int | B Float deriving Eq + +f :: Double -> Double +f x = x + x diff --git a/ghc/tests/ghci/prog002/A2.hs b/ghc/tests/ghci/prog002/A2.hs new file mode 100644 index 0000000..6dc493a --- /dev/null +++ b/ghc/tests/ghci/prog002/A2.hs @@ -0,0 +1,6 @@ +module A where + +data T = A Int | B Float deriving Eq + +f :: Int -> Int +f x = x + 3 diff --git a/ghc/tests/ghci/prog002/B.hs b/ghc/tests/ghci/prog002/B.hs new file mode 100644 index 0000000..6aced23 --- /dev/null +++ b/ghc/tests/ghci/prog002/B.hs @@ -0,0 +1,7 @@ +module B (f, g, h) where + +import A + +g x = f x + 1 + +h x = x `div` 2 diff --git a/ghc/tests/ghci/prog002/C.hs b/ghc/tests/ghci/prog002/C.hs new file mode 100644 index 0000000..b3baac2 --- /dev/null +++ b/ghc/tests/ghci/prog002/C.hs @@ -0,0 +1,5 @@ +module C (module B, module C) where + +import B + +k x = x `mod` 11 diff --git a/ghc/tests/ghci/prog002/D.hs b/ghc/tests/ghci/prog002/D.hs new file mode 100644 index 0000000..35672bd --- /dev/null +++ b/ghc/tests/ghci/prog002/D.hs @@ -0,0 +1,5 @@ +module Main where + +import C + +main = print ("hello world" ++ show (f 42)) diff --git a/ghc/tests/ghci/prog002/Makefile b/ghc/tests/ghci/prog002/Makefile new file mode 100644 index 0000000..fd68eaf --- /dev/null +++ b/ghc/tests/ghci/prog002/Makefile @@ -0,0 +1,7 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 2001/03/01 15:36:20 simonmar Exp $ + +TOP = ../.. +include $(TOP)/mk/boilerplate.mk + +include $(TOP)/mk/ghci.mk diff --git a/ghc/tests/ghci/prog002/prog002.script b/ghc/tests/ghci/prog002/prog002.script new file mode 100644 index 0000000..f81eea6 --- /dev/null +++ b/ghc/tests/ghci/prog002/prog002.script @@ -0,0 +1,39 @@ +-- first, clean up: +:! rm -f *.hi *.o *~ +:unset +s +:! cp A1.hs A.hs + +:load D + +-- compile A & reload +:! $HC $HC_OPTS -no-recomp -c A.hs +:reload + +B.g 42 +B.g 42 +B.g 42 + +-- swap A2 for A, compile & reload +:! cp A2.hs A.hs +:! $HC $HC_OPTS -no-recomp -c A.hs +:reload +-- the system should ignore the compiled version and compile its own. + +B.g 42 +B.g 42 +B.g 42 + +-- pick up newly compiled A +:load D + +B.g 42 +B.g 42 +B.g 42 + +-- remove A.o: system should recompile A +:! rm A.o +:reload + +B.g 42 +B.g 42 +B.g 42 diff --git a/ghc/tests/ghci/prog002/prog002.stderr b/ghc/tests/ghci/prog002/prog002.stderr new file mode 100644 index 0000000..55a038a --- /dev/null +++ b/ghc/tests/ghci/prog002/prog002.stderr @@ -0,0 +1,17 @@ +Compiling A (A.hs) +Compiling B (B.hs) +Compiling C (C.hs) +Compiling Main (D.hs) +Compiling A (A.hs) +Compiling B (B.hs) +Skipping C (C.hs) +Compiling Main (D.hs) +Skipping A (A.hs) + (using A.o) +Compiling B (B.hs) +Compiling C (C.hs) +Compiling Main (D.hs) +Compiling A (A.hs) +Skipping B (B.hs) +Skipping C (C.hs) +Skipping Main (D.hs) diff --git a/ghc/tests/ghci/prog002/prog002.stdout b/ghc/tests/ghci/prog002/prog002.stdout new file mode 100644 index 0000000..51c51e1 --- /dev/null +++ b/ghc/tests/ghci/prog002/prog002.stdout @@ -0,0 +1,64 @@ + ___ ___ _ + / _ \ /\ /\/ __(_) + / /_\// /_/ / / | | GHC Interactive, version 4.11, For Haskell 98. +/ /_\\/ __ / /___| | http://www.haskell.org/ghc/ +\____/\/ /_/\____/|_| Type :? for help. + +Loading package std ... linking ... done. +Prelude> -- first, clean up: +Prelude> :! rm -f *.hi *.o *~ +Prelude> :unset +s +Prelude> :! cp A1.hs A.hs +Prelude> +Prelude> :load D +Ok, modules loaded: Main, C, B, A. +Main> +Main> -- compile A & reload +Main> :! $HC $HC_OPTS -no-recomp -c A.hs +Main> :reload +Ok, modules loaded: Main, C, B, A. +Main> +Main> B.g 42 +85.0 +Main> B.g 42 +85.0 +Main> B.g 42 +85.0 +Main> +Main> -- swap A2 for A, compile & reload +Main> :! cp A2.hs A.hs +Main> :! $HC $HC_OPTS -no-recomp -c A.hs +Main> :reload +Ok, modules loaded: Main, C, B, A. +Main> -- the system should ignore the compiled version and compile its own. +Main> +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> +Main> -- pick up newly compiled A +Main> :load D +Ok, modules loaded: Main, C, B, A. +Main> +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> +Main> -- remove A.o: system should recompile A +Main> :! rm A.o +Main> :reload +Ok, modules loaded: Main, C, B, A. +Main> +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> B.g 42 +46 +Main> Leaving GHCi. diff --git a/ghc/tests/ghci/prog003/A.hs b/ghc/tests/ghci/prog003/A.hs new file mode 100644 index 0000000..855379c --- /dev/null +++ b/ghc/tests/ghci/prog003/A.hs @@ -0,0 +1,8 @@ +module Main(main,a) where + +import B +import C + +main = print (a 42) + +a x = b x + c x diff --git a/ghc/tests/ghci/prog003/B.hs b/ghc/tests/ghci/prog003/B.hs new file mode 100644 index 0000000..cd57965 --- /dev/null +++ b/ghc/tests/ghci/prog003/B.hs @@ -0,0 +1,5 @@ +module B where + +import D + +b x = d x diff --git a/ghc/tests/ghci/prog003/C.hs b/ghc/tests/ghci/prog003/C.hs new file mode 100644 index 0000000..7d8df58 --- /dev/null +++ b/ghc/tests/ghci/prog003/C.hs @@ -0,0 +1,5 @@ +module C where + +import D + +c x = d x diff --git a/ghc/tests/ghci/prog003/D.hs b/ghc/tests/ghci/prog003/D.hs new file mode 100644 index 0000000..a53a8c3 --- /dev/null +++ b/ghc/tests/ghci/prog003/D.hs @@ -0,0 +1,13 @@ +module D where + +-- data types and an instance +data D a = A Int | B Float deriving Eq +newtype N a = N Double +type T a = (Int,Double) + +-- a class +class C a where c :: a -> Int + +-- a function +d :: Float -> Float +d x = x / 3 diff --git a/ghc/tests/ghci/prog003/D1.hs b/ghc/tests/ghci/prog003/D1.hs new file mode 100644 index 0000000..4414d65 --- /dev/null +++ b/ghc/tests/ghci/prog003/D1.hs @@ -0,0 +1,13 @@ +module D where + +-- data types and an instance +data D a = A Int | B Float deriving Eq +newtype N a = N Double +type T a = (Int,Double) + +-- a class +class C a where c :: a -> Int + +-- a function +d :: Int -> Int +d x = x * 2 diff --git a/ghc/tests/ghci/prog003/D2.hs b/ghc/tests/ghci/prog003/D2.hs new file mode 100644 index 0000000..a53a8c3 --- /dev/null +++ b/ghc/tests/ghci/prog003/D2.hs @@ -0,0 +1,13 @@ +module D where + +-- data types and an instance +data D a = A Int | B Float deriving Eq +newtype N a = N Double +type T a = (Int,Double) + +-- a class +class C a where c :: a -> Int + +-- a function +d :: Float -> Float +d x = x / 3 diff --git a/ghc/tests/ghci/prog003/Makefile b/ghc/tests/ghci/prog003/Makefile new file mode 100644 index 0000000..1a5a2ef --- /dev/null +++ b/ghc/tests/ghci/prog003/Makefile @@ -0,0 +1,7 @@ +#----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 2001/03/01 15:36:21 simonmar Exp $ + +TOP = ../.. +include $(TOP)/mk/boilerplate.mk + +include $(TOP)/mk/ghci.mk diff --git a/ghc/tests/ghci/prog003/prog003.script b/ghc/tests/ghci/prog003/prog003.script new file mode 100644 index 0000000..0c67663 --- /dev/null +++ b/ghc/tests/ghci/prog003/prog003.script @@ -0,0 +1,73 @@ +-- A small multi-module program, with 4 modules, Main, B, C, D. B & C +-- 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. + +-- clean up +:! rm *.o *.hi +:unset +s +:! cp D1.hs D.hs + +:load A +:type a +a 42 + +-- sigh; sleep 1, because the comp manager only stores times in seconds +:! sleep 1; cp D2.hs D.hs +:reload +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- compile D, check that :reload doesn't pick it up +:! $HC $HC_OPTS -c D.hs +:reload +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- pick up the compiled D now, with :load +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- D,C compiled +:! $HC $HC_OPTS -c C.hs +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- D,C,B compiled +:! $HC $HC_OPTS -c B.hs +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- D,C,B,A compiled +:! $HC $HC_OPTS -c A.hs +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- D,C,A compiled (better not use A.o) +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- D,A compiled (better not use A.o) +:! rm C.o +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- A compiled (better not use A.o) +:! rm D.o +:load A +:type (Main.a,B.b,C.c,D.d) +a 42 + +-- A,B,C compiled (better not use A.o, B.o, C.o) +:! $HC $HC_OPTS --make A +:! rm D.o +:type (Main.a,B.b,C.c,D.d) +a 42 diff --git a/ghc/tests/ghci/prog003/prog003.stderr b/ghc/tests/ghci/prog003/prog003.stderr new file mode 100644 index 0000000..9f58f38 --- /dev/null +++ b/ghc/tests/ghci/prog003/prog003.stderr @@ -0,0 +1,58 @@ +Compiling D (D.hs) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +Compiling D (D.hs) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +Skipping D (D.hs) + (using D.o) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +Skipping D (D.hs) + (using D.o) +Skipping C (C.hs) + (using C.o) +Compiling B (B.hs) +Compiling Main (A.hs) +Skipping D (D.hs) + (using D.o) +Skipping C (C.hs) + (using C.o) +Skipping B (B.hs) + (using B.o) +Compiling Main (A.hs) +Skipping D (D.hs) + (using D.o) +Skipping C (C.hs) + (using C.o) +Skipping B (B.hs) + (using B.o) +Skipping Main (A.hs) + (using ./A.o) +Skipping D (D.hs) + (using D.o) +Skipping C (C.hs) + (using C.o) +Skipping B (B.hs) + (using B.o) +Skipping Main (A.hs) + (using ./A.o) +Skipping D (D.hs) + (using D.o) +Compiling C (C.hs) +Skipping B (B.hs) + (using B.o) +Compiling Main (A.hs) +Compiling D (D.hs) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +ghc: chasing modules from: A +Compiling D (D.hs) +Compiling C (C.hs) +Compiling B (B.hs) +Compiling Main (A.hs) +ghc: linking ... diff --git a/ghc/tests/ghci/prog003/prog003.stdout b/ghc/tests/ghci/prog003/prog003.stdout new file mode 100644 index 0000000..8de758d --- /dev/null +++ b/ghc/tests/ghci/prog003/prog003.stdout @@ -0,0 +1,119 @@ + ___ ___ _ + / _ \ /\ /\/ __(_) + / /_\// /_/ / / | | GHC Interactive, version 4.11, For Haskell 98. +/ /_\\/ __ / /___| | http://www.haskell.org/ghc/ +\____/\/ /_/\____/|_| Type :? for help. + +Loading package std ... linking ... done. +Prelude> -- A small multi-module program, with 4 modules, Main, B, C, D. B & C +Prelude> -- depend on D, and A depends on B & C. +Prelude> -- +Prelude> -- This test will try various combinations of compiled and interpreted +Prelude> -- versions of each module, and make sure each combination behaves +Prelude> -- sensibly. +Prelude> +Prelude> -- clean up +Prelude> :! rm *.o *.hi +Prelude> :unset +s +Prelude> :! cp D1.hs D.hs +Prelude> +Prelude> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type a +Int -> Int +Main> a 42 +168 +Main> +Main> -- sigh; sleep 1, because the comp manager only stores times in seconds +Main> :! sleep 1; cp D2.hs D.hs +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- compile D, check that :reload doesn't pick it up +Main> :! $HC $HC_OPTS -c D.hs +Main> :reload +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- pick up the compiled D now, with :load +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- D,C compiled +Main> :! $HC $HC_OPTS -c C.hs +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- D,C,B compiled +Main> :! $HC $HC_OPTS -c B.hs +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- D,C,B,A compiled +Main> :! $HC $HC_OPTS -c A.hs +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float) +Main> a 42 +28.0 +Main> +Main> -- D,C,A compiled (better not use A.o) +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float, + PrelFloat.Float -> PrelFloat.Float) +Main> a 42 +28.0 +Main> +Main> -- D,A compiled (better not use A.o) +Main> :! rm C.o +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- A compiled (better not use A.o) +Main> :! rm D.o +Main> :load A +Ok, modules loaded: Main, B, C, D. +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> +Main> -- A,B,C compiled (better not use A.o, B.o, C.o) +Main> :! $HC $HC_OPTS --make A +Main> :! rm D.o +Main> :type (Main.a,B.b,C.c,D.d) +(Float -> Float, Float -> Float, Float -> Float, Float -> Float) +Main> a 42 +28.0 +Main> Leaving GHCi.