有没有办法让GHCi在运行时发现调用产生的值与函数的模式匹配不匹配时产生更好的异常消息?
它目前给出了产生非详尽模式匹配的函数的行号,虽然有时有用但需要一轮调试,有时我觉得一遍又一遍地做同样的事情.所以在我尝试整理解决方案之前,我想看看是否存在其他问题.
除了提供行号之外的异常消息还显示了它试图进行的呼叫类型?
这甚至可能吗?
我有以下代码:
F (S core ps) = FAll core [] ps
where
FAll core acc ((name, (pc : pcs)) : ps)
= case F' (pc : pcs) (readC pc core) core of
Nothing ->
if (length pcs) /= 0 then FAll core ((name, pcs) : acc) ps
else FAll core acc ps
Just (core', [pc']) -> let
pc'' = pc' `mod` coresize
pcs' = pcs ++ [pc'']
in FAll core' ((name, pcs') : acc) ps
stepAll core acc [] = S …Run Code Online (Sandbox Code Playgroud)