小编tom*_*mss的帖子

打印两个数字的总和Haskell

如何打印两个数字之和的结果?

 main:: IO()
 main = do putStrLn "Insert the first value: "  
        one <- getLine  
        putStrLn "Insert the second value: "  
        two <- getLine    
        putStrLn "The result is:"
    print (one+two)
Run Code Online (Sandbox Code Playgroud)

这给了我一个错误:

  ERROR file:.\IO.hs:3 - Type error in application
  *** Expression     : putStrLn "The result is:" print (one + two)
  *** Term           : putStrLn
  *** Type           : String -> IO ()
  *** Does not match : a -> b -> c -> d
Run Code Online (Sandbox Code Playgroud)

haskell

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

标签 统计

haskell ×1