id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
1455	Wildcard pattern _ generates defaulting warning	guest		"The ''second'' use of properFraction generates a Defaulting warning, even though the Integral value in question is being thrown away:

{{{
module Main where

r :: Double
r = pi

main :: IO ()
main = 
   let (_,x) = properFraction r :: (Integer,Double)
       (_,y) = properFraction r
   in  putStrLn $ show (x,y)
}}}

It is clearly trivial to work around this issue. However, if one takes the point of view that all of one's final code should compile using the -Wall -Werror flags, then the work around confirms dynamic typers' worst fears about Haskell. One shouldn't have to say anything about a value that's being thrown away; the compiler should make the most efficient call what to do, not e.g. some tightly wound mathematician who believes that Integer is the only valid Integral type.

Here is the compiler output:

{{{
% ghc -v -Wall -Werror Bug.hs
Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC version 6.6
Using package config file: /usr/local/lib/ghc-6.6/package.conf
wired-in package base mapped to base-2.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.0
Hsc static flags: -static
Created temporary directory: /tmp/ghc12130_0
*** Checking old interface for main:Main:
*** Parser:
*** Renamer/typechecker:

Bug.hs:9:15:
    Warning: Defaulting the following constraint(s) to type `Integer'
             `Integral t' arising from use of `properFraction' at Bug.hs:9:15-30
             In the expression: properFraction r
             In a pattern binding: (_, y) = properFraction r
             In the expression:
                 let
                   (_, x) = properFraction r :: (Integer, Double)
                   (_, y) = properFraction r
                 in putStrLn $ (show (x, y))
*** Deleting temp files:
Deleting: /tmp/ghc12130_0/ghc12130_0.s
Warning: deleting non-existent /tmp/ghc12130_0/ghc12130_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc12130_0
}}}"	bug	closed	low		Compiler	6.6	wontfix	wildcard defaulting warning		MacOS X	x86		Unknown				
