Using unsafePerformIO safely

25 Jun
2009
25 Jun
'09
3:38 p.m.
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.
5857
Age (days ago)
5857
Last active (days ago)
0 comments
1 participants
participants (1)
-
gladsteinīŧ gladstein.com