#4516: Over eager non-exhaustive pattern match warnings in lambda expressions.
---------------------------------+------------------------------------------
    Reporter:  benl              |       Owner:                                 
  
        Type:  bug               |      Status:  new                            
  
    Priority:  normal            |   Component:  Compiler                       
  
     Version:  7.0.1             |    Keywords:                                 
  
    Testcase:                    |   Blockedby:                                 
  
          Os:  Unknown/Multiple  |    Blocking:                                 
  
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at 
compile-time
---------------------------------+------------------------------------------
 When I write:
 {{{
 let thing = (\(Just x) -> x) whatever
 in  rest
 }}}

 GHC shouldn't complain about non-exhaustive pattern matches for this code,
 because the form of the expression makes it obvious that some patterns are
 not being matched. The above fragment should behave like:

 {{{
 let thing = let Just x = whatever in x
 in  rest
 }}}

 This pattern is also non-exhaustive, but that's obvious from the form of
 the expression.  I use both of these forms all the time because the
 alternative of using something like {{{fromJust}}} gives bad error
 messages when it fails.

 Here's a more concrete example from DDC:
 {{{
 let vks' = map (\(T.TVar k (T.UVar v')) -> (v', k))
          $ map toCoreT cts
 }}}

 To update my code to work with 7.0.1 I have to change all of these to:
 {{{
 let vks' = map (\tt -> let T.TVar k (T.UVar v') = tt in (v', k))
          $ map toCoreT cts
 }}}

 This is longer, uglier, and requires the introduction of the dummy
 variable {{{tt}}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4516>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to