[<<][rtl][>>][..]
Fri Aug 10 18:39:09 EDT 2018

output to input dependency?

Is it possible to compute the output based on the input in the ST
here?  Let's give it a try with a test case.

seqRun ::
  (forall s. ([Mem s], rd, r, [Int]) -> ST s (rd, r, [Int]))
  -> [Int]
  -> (rd, r)
  -> [Int -> Int]
  -> [[Int]] -> [[Int]]
seqRun f memBits (rd0, r0) memInits i = 
  runST $ do
    a <- sequence $ zipWith seqMemInit memBits memInits
    let u _ _ [] = return []
        u rd r (i:is) = do
          (rd',r',o) <- f (a, rd, r, i)
          os <- u rd' r' is
          return (o:os)
    u rd0 r0 i


This produces <<loop>>

l_st = seq where 
  seq = ([0] : seq')
  seq' = seqRun (\([], (), (), [i]) -> return ((), (), [i])) [] ((), ()) [] seq

So it needs a lazy state implementation.




[Reply][About]
[<<][rtl][>>][..]