I am currently following the exercises in the book: “Haskell Expression School” and reached chapter three on creating graphics. The book uses the SOEGraphics module and demonstrates how to draw plain text in a window and then close it with the click of a button.
However, when, after compilation and execution, I found that although the window appears with the text on the screen, the window refuses to close no matter which keys I press, or the focus is on the command line or the window itself.
Here is the source code from the book:
module Main where
import SOE
main = runGraphics(
do w <- openWindow
"My First Graphics Program" (300, 300)
drawInWindow w (text(100,200) "HelloGraphicsWorld")
k <- getKey w
closeWindow w
)
The only way to close a window is to force it to exit using CTRL-C. Is there something I forgot with my code? The program was compiled using GHC 7.4.1 and launched on Ubuntu.