小编Lau*_*oki的帖子

Haskell IO:无法将预期类型"IO a0"与实际类型匹配

我是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)

haskell

6
推荐指数
1
解决办法
2万
查看次数

如何创建一个发射键盘高度的 RxSwift Observable?

我想观察 iOS 键盘的高度。我如何使用 RxSwift 做到这一点?

ios rx-swift

3
推荐指数
1
解决办法
4328
查看次数

标签 统计

haskell ×1

ios ×1

rx-swift ×1