1.5 测试

chylli's picture

1.5 测试
现在来试试这个错误信息如何利用。

module Main where
import Control.Monad.Error
import Arith
import ArithParser

main = liftM parseArith getContents >>= print

运行一下,然后输入一些错误信息:

 runhaskell -i../Arith1 Main.lhs
aLeft Parse Error: "ArithParser" (line 1, column 1):
unexpected "a"
expecting space, "/*", "true", "false", "if", "succ", "pred", "iszero", digit or "("

再比较一下原来的错误信息:

[chylli@arch Arith2] cd ../Arith1
[chylli@arch Arith1] runhaskell Main.lhs
aMain.lhs: "ArithParser" (line 1, column 1):

...... full content is only available to community members.