
#7649: BangPatterns + ViewPatterns ---------------------------------+------------------------------------------ Reporter: igloo | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ This program: {{{ {-# LANGUAGE ViewPatterns, BangPatterns #-} import Control.Exception main :: IO () main = do print (f False) print (f True) print (g undefined) `catchE` \_ -> putStrLn "g exception" print (h undefined) `catchE` \_ -> putStrLn "h exception" print (i undefined) `catchE` \_ -> putStrLn "i exception" putStrLn "Done" f :: Bool -> String f (view -> Nothing) = "Got Nothing" f (view -> Just x) = "Got Just " ++ show x g :: Bool -> String g (view -> x) = "g Got something" h :: Bool -> String h (view -> !x) = "h Got something" i :: Bool -> String i !(view -> x) = "i Got something" view :: Bool -> Maybe Int view False = Nothing view True = Just 5 catchE :: IO a -> (ErrorCall -> IO a) -> IO a catchE = catch }}} prints: {{{ "Got Nothing" "Got Just 5" "g Got something" "h exception "i Got something" Done }}} but presumably `i` ought to be strict in `x`. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7649 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler