OverloadedStrings induces overlapping pattern matches
The OverloadedStrings extension sometimes causes GHC to warn about overlapping pattern matches, when there are not overlapping pattern matches.
To reproduce, create the file BadWarning.hs:
{-# LANGUAGE OverloadedStrings #-}
module BadWarning where
data MyString = MyString String
func (MyString "a") = undefined
func (MyString "bb") = undefined
func _ = undefined
Load the program with ghci -W BadWarning.hs, and ghci outputs
GHCi, version 7.0.2: 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.
[1 of 1] Compiling BadWarning ( BadWarning.hs, interpreted )
BadWarning.hs:6:1:
Warning: Pattern match(es) are overlapped
In an equation for `func': func (MyString "a") = ...
Ok, modules loaded: BadWarning.
*BadWarning>
The warning goes away if you remove the OverloadedStrings extension. The warning also goes away if you change (MyString "bb") to (MyString "b") or (MyString "").
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |