我有一个非常简单的程序Main.hs
,可以很好地用作已编译程序:
module Main( main ) where
import System.Environment ( getArgs )
atoi :: String -> Int
atoi s = read s :: Int
main :: IO ()
main = do
(x:y:_) <- getArgs
case compare (atoi x) (atoi y) of
LT -> putStrLn "x < y"
GT -> putStrLn "x > y"
EQ -> putStrLn "x = y"
当我尝试使用以下命令进行调试时:
$ ghci Main.hs
:set args 55 26667
break main
我收到以下错误:
<interactive>:2:7: error:
• Couldn't match expected type ‘a -> Bool’ with actual type ‘IO ()’
• In the first argument of ‘break’, namely ‘main’
In the expression: break main
In an equation for ‘it’: it = break main
• Relevant bindings include
it :: [a] -> ([a], [a]) (bound at <interactive>:2:1)
*Main>
我究竟做错了什么?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句