id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5560,case and type synonym,sleepyMonad,,"Observed on arch linux, 7.0.3 ghc. (package version 7.0.3-2)
The warning is suspicious; the result for switchOnEvent2 bp is wrong.
It works however if no type synonym is used (as illustrated).

Thanks

-- patrick

{{{
[patrick@eee2 launcher]$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :l testme
[1 of 1] Compiling Main             ( testme.hs, interpreted )

testme.hs:10:1:
    Warning: Pattern match(es) are overlapped
             In an equation for `switchOnEvent2':
                 switchOnEvent2 bp = ...
                 switchOnEvent2 _ = ...
Ok, modules loaded: Main.
*Main> switchOnEvent2 kp
KP
*Main> switchOnEvent2 bp
KP
*Main> switchOnEvent3 202
KP
*Main> switchOnEvent3 204
BP
*Main> switchOnEvent3 203
??
*Main> >
}}}

{{{
-- testme.hs:

import Data.Word

type MyEventType = Word32
kp :: MyEventType
kp = 102
bp :: MyEventType
bp = 104

switchOnEvent2 :: MyEventType -> IO ()
switchOnEvent2 kp = do putStrLn ""KP""
switchOnEvent2 bp = do putStrLn ""BP""
switchOnEvent2 _ = do putStrLn ""??""

switchOnEvent3 :: Word32 -> IO ()
switchOnEvent3 202 = do putStrLn ""KP""
switchOnEvent3 204 = do putStrLn ""BP""
switchOnEvent3 _ = do putStrLn ""??""
}}}
",bug,closed,normal,,Compiler,7.0.2,invalid,,,Linux,x86,Incorrect result at runtime,,,,,
