This is a follow up question to this. I'm using a graphic library in Haskell called Threepenny-GUI. In this library the main function returns a UI
monad object. I'm trying to execute a simple print command with no success. What is a right work around to enable printing for debugging purposes.
Code:
main :: IO ()
main = startGUI defaultConfig setup
setup :: Window -> UI ()
setup w = do
print "debug message 1 "
Error:
Couldn't match type ‘IO’ with ‘UI’
Expected type: UI ()
Actual type: IO ()
In a stmt of a 'do' block: print "labels and values "
do
block must contain only one monad (ie eitherUI
orIO
but not both). If you want to debug in Haskell, a debugger might be useful. – Goingsprint
. One thing that helps is StackOverflow shortcut Ctrl-k. If you highlight a block of text in a question or answer and hit Ctrl-k, it will indent each line by 4 spaces. As far as I know, this shortcut isn't officially documented anywhere but it's handy. – Xerox