我是Haskell的新手,我试着理解如何正确地执行IO.
以下工作正常:
main = do
action <- cmdParser
putStrLn "Username to add to the password manager:"
username <- getLine
case action of
Add -> persist entry
where
entry = Entry username "somepassword"
Run Code Online (Sandbox Code Playgroud)
以下结果导致编译错误:
main = do
action <- cmdParser
case action of
Add -> persist entry
where
entry = Entry promptUsername "somepassword"
promptUsername = do
putStrLn "Username to add to the password manager:"
username <- getLine
Run Code Online (Sandbox Code Playgroud)
错误在这里:
Couldn't match expected type `IO b0' with actual type `[Char]'
Expected type: IO …Run Code Online (Sandbox Code Playgroud) 我想观察 iOS 键盘的高度。我如何使用 RxSwift 做到这一点?