|
RE: Bug in do expressions: msg#00028lang.haskell.glasgow.bugs
Ah, indeed so. Thank you for reporting this. It turned out to be caused by a function written like this f (C a) = ... f (D a b) = ... f other = False The data type changed, and we should have added a new case to the function, but the default case caught it, so there was no indication. It just shows: don't use default cases! The good news is that I managed to fix it by eliminating 'f' altogether (it was called 'failureFreePat' in fact). So GHC is 30 lines shorter thanks to you. Simon | -----Original Message----- | From: Andrew J Bromage [mailto:ajb@xxxxxxxxxxx] | Sent: 21 November 2002 00:45 | To: glasgow-haskell-bugs@xxxxxxxxxxx | Subject: Bug in do expressions | | G'day all. | | In a recent GHC checkout, the following program: | | module Main(main) where | | import Maybe | import Control.Monad | | test :: (MonadPlus m) => [a] -> m Bool | test xs | = do | (_:_) <- return xs | return True | `mplus` | do | return False | | main :: IO () | main | = do let x = fromJust (test []) | putStrLn (show x) | | causes a run-time exception: | | *** Exception: GhcBug.hs:9: Non-exhaustive patterns in 'do' expression | | Version 5.04 correctly prints "False". | | Cheers, | Andrew Bromage | _______________________________________________ | Glasgow-haskell-bugs mailing list | Glasgow-haskell-bugs@xxxxxxxxxxx | http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Bug in do expressions, Andrew J Bromage |
|---|---|
| Next by Date: | Re: Bug in do expressions, Andrew J Bromage |
| Previous by Thread: | Bug in do expressions, Andrew J Bromage |
| Next by Thread: | Re: Bug in do expressions, Andrew J Bromage |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |