[Hat] Pattern match errors in do?

Neil Mitchell ndmitchell at gmail.com
Wed Jul 5 10:49:15 EDT 2006


Hi

With the following program:

---------------------------------
import System

main = do (x:_) <- getArgs
          print $ fact (read x)


fact :: Int -> Int
fact 0 = 1
fact n | n > 0 = n * fact (n - 1)
--------------------------------

Running Main without any arguments via Hat gives me a trace, and the
error message:

> Error: pattern-match failure in do expression

Running hat-stack Main.hat gives me:

> Tracefile "Main.hat" contains no reference to a program error.

How come? I get the same results on both Windows and Linux.

Thanks

Neil


More information about the Hat mailing list