Regarding how to make the show instructions cause printout as soon as
they are executed:

If you write your interpreter to return a list of printout lines
(strings), you get this behavior for free. Haskell's laziness enables
the printing to start right away, while in an imperative language the
list of strings wouldn't be returned until it was complete.

To see this in action, try this program:

main = mapM putStrLn myList

myList = ["first", "second", loop, "third"]

loop = loop 

Despite the infinite loop, "first" and "second" print out.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to