projects
/
matthijs
/
master-project
/
cλash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dcf9dd6
)
Rename a bunch of type variables.
author
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Fri, 30 Jan 2009 09:13:45 +0000
(10:13 +0100)
committer
Matthijs Kooijman
<m.kooijman@student.utwente.nl>
Fri, 30 Jan 2009 09:13:45 +0000
(10:13 +0100)
Sim.hs
patch
|
blob
|
history
diff --git
a/Sim.hs
b/Sim.hs
index 771896ffc2e8280470cf8ac741c0c5f099b3ee4b..3be038d3b11d8bfef33de0dde4be1fdc5927aa22 100644
(file)
--- a/
Sim.hs
+++ b/
Sim.hs
@@
-12,23
+12,23
@@
simulate f input s = do
output = run f input s
-- A circuit with input of type a, state of type s and output of type b
output = run f input s
-- A circuit with input of type a, state of type s and output of type b
-type Circuit
a s b = a -> s -> (s, b
)
+type Circuit
i s o = i -> s -> (s, o
)
-run :: Circuit
a s b -> [a] -> s -> [(a, b
, s)]
+run :: Circuit
i s o -> [i] -> s -> [(i, o
, s)]
run f (i:input) s =
(i, o, s'): (run f input s')
where
(s', o) = f i s
run _ [] _ = []
run f (i:input) s =
(i, o, s'): (run f input s')
where
(s', o) = f i s
run _ [] _ = []
-simulateIO :: (Read
a, Show a, Show b, Show s) => Sim.Circuit a s b
-> s -> IO()
+simulateIO :: (Read
i, Show i, Show o, Show s) => Sim.Circuit i s o
-> s -> IO()
simulateIO c s = do
putStr "Initial State: "
putStr $ show s
putStr "\n\n"
runIO c s
simulateIO c s = do
putStr "Initial State: "
putStr $ show s
putStr "\n\n"
runIO c s
-runIO :: (Read
a, Show a, Show b, Show s) => Sim.Circuit a s b
-> s -> IO()
+runIO :: (Read
i, Show i, Show o, Show s) => Sim.Circuit i s o
-> s -> IO()
runIO f s = do
putStr "\nInput? "
line <- getLine
runIO f s = do
putStr "\nInput? "
line <- getLine