Non-exhaustive patterns in function provSrcLoc

1999-06-13 Thread Michael Weber

Hi!

Yes, I know, the following code snippets are wrong, because instances are
always imported. The compiler yields an error message, like it should:


Foo1.lhs:2:
Duplicate or overlapping instance declarations
for `Read FooData'
Name.lhs:382: Non-exhaustive patterns in function provSrcLoc


But the "Non-exhaustive patterns" error shouldn't be there, should it?
BTW: is it possible to show the names of the overlapping modules?


Cheers,
Michael

\begin{code}
module Data where
data FooData = FooData
\end{code}

\begin{code}
module Foo2 where
import Data
instance Read FooData where
   readsPrec _ _ = [(FooData,"")]
\end{code}

\begin{code}
module Foo3 where
import Data
instance Read FooData where
   readsPrec _ _ = [(FooData,"")]
\end{code}

\begin{code}
module Foo1 where
import Data
import Foo2
import Foo3

data Baz = Baz deriving Read -- if this line is commented out -> no error
trigger  = FooData   -- else, if this line is commented out -> no error
 -- instances only imported if used?
\end{code}
-- 
XXXVII:
Ninety percent of the time things will turn out worse than you expect.
The other 10 percent of the time you had no right to expect so much.



RE: Non-exhaustive patterns in function provSrcLoc

1999-06-14 Thread Simon Peyton-Jones

> Yes, I know, the following code snippets are wrong, because 
> instances are
> always imported. The compiler yields an error message, like it should:
> 
> 
> Foo1.lhs:2:
> Duplicate or overlapping instance declarations
> for `Read FooData'
> Name.lhs:382: Non-exhaustive patterns in function provSrcLoc
> 
> 
> But the "Non-exhaustive patterns" error shouldn't be there, should it?
> BTW: is it possible to show the names of the overlapping modules?

Thanks for this bug report.  Now fixed in the CVS tree:

 Duplicate or overlapping instance declarations
 for `Read FooData'
 imported from module `Inst82_1' and imported from module `Inst82_2'

Simon