dtchepak/guessthenumberfsharp — pull request #1 by xerxesb (2013-03-16 23:55:11+00:00)
Title: Splitting UI concern (or keeping purity)

the other thing i dont like about this code is that the side-effecting functions to printfn and readline are kind of mixed up with the logic of the program.

I'm wondering about this from two angles:
1. How can the program be changed to make the program pure functional and perform the IO in context (ie what would Haskell do)

2. If i were doing this OO-style, i'd have a game class that operates independently of any UI, so that the core game logic is cohesive. Perhaps expose properties of the Game to determine it's state, or an event to notify the UI when the game is over, etc...how could this FP program be equally "separated" (assuming we wanted to slap on a WinForms UI to the same game)?