Pattern match errors in do?
"Neil Mitchell" <[email protected]> Wed, 5 Jul 2006 15:49:15 +0100
| Newsgroups | gmane.comp.lang.haskell.hat |
|---|---|
| Message-ID | <[email protected]> |
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