Sun Oct 16 12:20:06 EDT 2011

Full circle?

Milestone: SysM composes with TML!

f :: (Code Tfloat, Code Tfloat) 
     -> MCode r (Code Tfloat, Code Tfloat)
f (s, i) = do
  s' <- add s i
  return (s', s')
fs = SysM f (lit 0)
sysFun (SysM f f0) = genFun f

*Main> sysFun (fs . fs . fs)
in:  [f.in0,f.in1,f.in2,f.in3]
out: [f.2,f.1,f.0,f.2]
f.0 <- f.add f.in2 f.in3
f.1 <- f.add f.in1 f.0
f.2 <- f.add f.in0 f.1

Let's see if that's correct by changing var names

*Main> sysFun (fs . fs . fs)
in:  [s2,  s1,  s0,  i]
out: [s2', s1', s0', s2']
s0' <- f.add s0 i
s1' <- f.add s1 s0'
s2' <- f.add s2 s1'

Yep seems to work!