1.5 测试

Sat, 2008/09/13 - 00:24 — chylli
1.5 测试
现在来试试这个错误信息如何利用。
module Main where
import Control.Monad.Error
import Arith
import ArithParser
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 "("
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):
[chylli@arch Arith1] runhaskell Main.lhs
aMain.lhs: "ArithParser" (line 1, column 1):
- Login to post comments
- 156 reads
|
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> |