Commit b3834c59 authored by simonmar's avatar simonmar
Browse files

[project @ 2001-03-01 15:36:20 by simonmar]

The beginnings of a GHCi test suite.
parent 907ab722
#-----------------------------------------------------------------------------
# $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
-- bug: shouldn't be defaulting these expressions
:type (+)
:type enumFromTo
-- bug: we used to throw away the instance accidentally here
:m PrelBase
1 == (2 :: Int)
1 == (2 :: Int)
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | 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.
module Main where
import B
main = print ("hello world" ++ show (f 42))
module B (module B, module C) where
import C
k x = x `mod` 11
module C (f, g, h) where
import D
g x = f x + 1
h x = x `div` 2
module D where
data T = A Int | B Float deriving Eq
f x = x + 1
module D where
data T = A Int | B Float deriving Eq
f x = x + x
module D where
data T = A Int | B Float deriving Eq
f x = x + 1
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.1 2001/03/01 15:36:20 simonmar Exp $
TOP = ../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/ghci.mk
-- 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
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)
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | 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.
module A where
data T = A Int | B Float deriving Eq
f :: Int -> Int
f x = x + 3
module A where
data T = A Int | B Float deriving Eq
f :: Double -> Double
f x = x + x
module A where
data T = A Int | B Float deriving Eq
f :: Int -> Int
f x = x + 3
module B (f, g, h) where
import A
g x = f x + 1
h x = x `div` 2
module C (module B, module C) where
import B
k x = x `mod` 11
module Main where
import C
main = print ("hello world" ++ show (f 42))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment