id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
1148	Bad warnings about unused imports that are in fact needed	brianh		"If I compile the following code with the `-W` flag I get a warning about the import of `Data.Ix` that shouldn't be generated, since this import is actually needed:
{{{
{-# OPTIONS_GHC -fglasgow-exts #-}
module ArrayBoundedU
   ( T
   , create
   , at
   ) where

import Data.Ix
import qualified Data.Array.Unboxed as Array
import Data.Array.Base (unsafeAt)

newtype T i e = T (Array.UArray i e)

create :: (Ix i, Bounded i, Array.IArray Array.UArray e) => [(i,e)] -> T i e
create ies = T (Array.array (minBound, maxBound) ies)

at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e
at (T a) i = unsafeAt a (index (minBound, maxBound) i)
}}}
with a sample `Main`
{{{
module Main where

import Data.Ix
import ArrayBoundedU

data I = One | Two | Three
   deriving (Eq, Ord, Ix, Bounded)

main = do
   let
      a = create [(One, 10::Int), (Two, 20), (Three, 30)]
   putStrLn (show (at a Two))
}}}
built using ghc6.6 with:
{{{
ghc --make Main.hs -W
}}}
I get the warning:
{{{
ArrayBoundedU.hs:8:0:
   Warning: Module `Data.Ix' is imported, but nothing from it is used,
      except perhaps instances visible in `Data.Ix'
   To suppress this warning, use: import Data.Ix()
}}}
However if I do this then the code doesn't compile at all, since the import '''is''' needed.

This is just a very trivial little thing but it prevents me from being able to get my code to compile with no warnings (unless I switched the warning off altogether but then something else which really was unused would go undetected)."	bug	closed	lowest	_|_	Compiler	6.8.2	fixed	warning unused import		Windows	x86		Unknown				
