Skip to content

No warnings produced, yet the pattern matching fails at runtime.

The code below should produce a warning about a non-exhaustive pattern in the failure, yet it compiles alright. `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

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.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information