[GHC] #13517: No warnings produced, yet the pattern matching fails at runtime.

GHC ghc-devs at haskell.org
Mon Apr 3 08:32:49 UTC 2017


#13517: No warnings produced, yet the pattern matching fails at runtime.
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:  (none)
  timotej.tomandl                    |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternMatchWarnings               |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The code below should produce a warning about a non-exhaustive pattern in
 the failure, yet it compiles alright.
 {{{
 #!div style="font-size: 80%"
 {{{#!haskell
 {-# OPTIONS_GHC -Wall -Werror #-}

 action :: (Monad m)=>t->m (Maybe a)
 action _=return Nothing

 failure :: (Monad m)=>Int->(m Int)
 failure x=do
     Just y<-action x
     return y

 main :: IO()
 main=do
     y<-failure 1
     putStrLn $ (show y)
 }}}
 }}}

 The same should be the case if we replace the definition of failure with

 {{{
 #!div style="font-size: 80%"
 {{{#!haskell
 failure :: (Monad m)=>Int->(m Int)
 failure x=(action x)>>=(\(Just y)->return y)
 }}}
 }}}

 yet once again no warnings are produced.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13517>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list