#1455: Wildcard pattern _ generates defaulting warning
--------------------------------------------+-------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 6.6
Severity: trivial | Resolution:
Keywords: wildcard defaulting warning | Difficulty: Unknown
Os: MacOS X | Testcase:
Architecture: x86 |
--------------------------------------------+-------------------------------
Comment (by Isaac Dupree):
Unfortunately, the type-class could be used in some way that determines
other parts of the result. For example
{{{
properFractionNOT :: (RealFrac a, Integral b) => a -> (b, a)
properFractionNOT a = (b', a')
where
a' = a + (fromIntegral (5000000000000000 `asTypeOf` b'))
b' = 2
}}}
produces different answers depending on the type of b:
{{{
> snd $ (properFractionNOT:: Rational -> (Integer,Rational)) 3
5000000000000003%1
> snd $ (properFractionNOT:: Rational -> (Int,Rational)) 3
937459715%1
}}}
So it is, at least, not _easy_ to detect situations where the class-
constraint is used only to determine the very same result...
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1455>
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