Haskell playIO 有以下类型:
playIO:: Display
-> Color background color
-> Int
-> world --initial world
-> (world -> IO Picture) -- function to change world into a picture
-> (Event -> world -> IO world) --event handler function
-> (Float -> world -> IO world) -- The function to update the world after the given time
-> IO ()
一旦你playIO
在里面调用main
,它就会不断运行更新由world
. 如果在处理事件的代码(参见代码注释)或更新世界的函数中发生了某些事情,并且您想输出一条消息(不一定是错误),使用什么方法不违反类型?是否必须打破功能playIO
来显示我的信息,如果是这样,人们将如何做到这一点?