ghci 设置断点失败

ghci fails to set breakpoint

我有一个非常简单的 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> 

我做错了什么?

GHCi 命令以 : 开头,以区别于 Haskell 表达式。 break is the name of a Haskell function to split a list on a given condition. To use GHCi breakpoints, use :break 相反。