The state itself is still empty, this uses the (yank-pasted) stateless
function from Sim.hs to reuse the existing full_adder.
mainIO f = Sim.simulateIO (Sim.stateless f) ()
+-- This function is from Sim.hs, but we redefine it here so it can get inlined
+-- by default.
+stateless f = \i s -> (s, f i)
+
show_add f = do print ("Sum: " ++ (displaysigs s)); print ("Carry: " ++ (displaysig c))
where
a = [High, High, High, High]
(s, c2) = half_adder(s1, cin)
c = c1 `hwor` c2
+sfull_adder = stateless full_adder
+
-- Four bit adder
-- Explicit version
-- [a] -> [b] -> ([s], cout)