Dear All,
The following program results in a stack overflow. My intuition says that
lazy evaluation should allow us to make it work. How do we need to change
System.IO to make it work?
module Main
import System.IO
import Control.Monad
import Data.List
doPrintAll :: [String] -> IO ()
doPrintAll strings = mapM_ putStr strings
output :: [String]
output = take 1000000 (repeat "")
Start world = execIO (doPrintAll output) world
The following program works. Somehow using System.IO should result in
equivalent behaviour.
module Main
import StdEnv
import Data.List
printAll :: [String] *World -> *((), !*World)
printAll [] world = ((), world)
printAll [str:strings] world
# (out, world) = stdio world
# out = fwrites str out
# (_, world) = fclose out world
= printAll strings world
output :: [String]
output = take 1000000 (repeat "")
Start world = printAll output world
Best regards,
Markus
_______________________________________________
clean-list mailing list
[email protected]
https://mailman.science.ru.nl/mailman/listinfo/clean-list