
Excellent, is there a -fuse-catch flag for ghc? :)
No, but there is for Yhc. If you write to the Haskell standard (minus a little bit), don't like libraries and can get Yhc to compile (good luck!) then it's just a few command lines away. If GHC (or GHC + some scripts) could produce a single Core file representing a whole program, including all necessary libraries, then implementing Catch would be a weekends work. Thanks Neil
On Tue, May 19, 2009 at 12:01 PM, Neil Mitchell
wrote: > ... exhaustive pattern checking might well help out a lot of > people coming from untyped backgrounds...
Or even people from typed backgrounds. I worship at the altar of exhaustiveness checking.
Do you really want exhaustiveness, or is what you actually want safety?
With -fwarn-incomplete-patterns:
test1 = head []
test2 = x where (x:xs) = []
test3 = (\(x:xs) -> 1) []
test4 = f [] where f [] = 1
GHC reports that test4 has incomplete patterns, but the others don't. However, test4 is safe, but the others aren't. Exhaustiveness is a poor approximation of safety. GHC's exhaustiveness checker is a poor approximation of exhaustiveness. 2 is a poor approximation of pi :-)
Using Catch, it reports that test1..3 were faulty, but test4 is safe.
Thanks
Neil _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users