I am experimenting with wxHaskell. I could not run the application under ghci, so I need to use the application to check it. I wanted to test the program using println debugging. However, it seems that putStrLn does not work in the GUI:
{-# LANGUAGE Haskell2010 #-}
module Main where
import Graphics.UI.WX
drawUI dc view = do
circle dc (point 10 10) 5 [penKind := PenSolid, color := red]
putStrLn "painted"
helloGui :: IO ()
helloGui = do
f <- frame [
text := "Example",
resizeable := False,
bgcolor := white,
layout := space 400 300,
on paint := drawUI]
return ()
main :: IO ()
main = do
putStrLn "Started"
start helloGui
If I comment on the beginning of helloGui, everything will print well. However, if I return it, nothing will be printed, but a window will be displayed. What is wrong here?
source
share