
Is there any work on automatic translation of code in some tiny imperative language into Haskell code that uses the ST and/or IO monads (or perhaps even pure functional code)? For example, the user writes something vaguely like array = newArray (1,100) 1 for x=2 to 99 array[x] := array[x-1]+array[x+1] And it is transformed into something like foldl (>>=) (newArray (1,100) 1) $ map (\n arr -> do a <- readArray arr (n-1) b <- readArray arr (n+1) writeArray arr n (a+b) return arr) [2..99] Obviously the "small imperative language" would have to be highly restricted and carefully chosen in order for the translation to always work and be predictable. I'm interested in any existing work on choosing such a sublanguage. Thanks! - a -- PGP/GPG: 5C9F F366 C9CF 2145 E770 B1B8 EFB1 462D A146 C380