我编写了一个函数,将当前屏幕宽度作为IO Integer返回(到目前为止工作).
getScreenWidth:: IO Integer
getScreenWidth = do
(sx, sy, w, h) <- getScreenDim 0
return $ sx
Run Code Online (Sandbox Code Playgroud)
现在我想将屏幕宽度添加到字符串:
> magic_function :: IO Integer -> String -> ... magic output type
> magic_function = ... ? this is where i am stack at ? ...
Run Code Online (Sandbox Code Playgroud)
我想魔术函数传递一个字符串,像"屏幕宽度:"我希望它添加当前屏幕的宽度,使我得到"屏幕宽度:1680".如何连接IO Integer和常用String?它有用show吗?
有人可以帮我吗?