[Haskell-cafe] bug in ghci ?
Pasqualino "Titto" Assini
tittoassini at gmail.com
Thu Jul 8 10:08:46 EDT 2010
Well the problem is that no warnings are generated.
If you have a class with some methods that do not have a default
implementation and you do not provide them when defining your
instance, GHC will at least politely complain.
Ideally, GHC would detect that a Show instance requires one of its two
functions to be declared as they are mutually recursive and complain.
Is that too much to ask?
Maybe it is, and I can see why ghc developers would not bother, but
can we agree that if not a bug, this is at least an inconvenience ?
It took me a while to determine that it was not my own code but rather
the incomplete show instance that was sinking my app :-)
On 8 July 2010 14:47, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
> "Pasqualino \"Titto\" Assini" <tittoassini at gmail.com> writes:
>> Thanks for the explanation.
>> What I meant is not that is a bug that it recurses but rather the fact
>> that the compiler will accept this incomplete definition without
>> This problem has bitten me twice while trying to use automatic
>> derivation of a data type in another file.
>> In my innocence I wrote:
>> instance Show Test
>> rather than
>> deriving instance Show Test
>> I didn't notice the error as GHC seemed to be happy and then when I
>> tried to use it: BANG!
>> Very confusing.
>> I suppose that Haskell has spoiled me, if it compiles I assume that it
>> will work :-)
> As I said, there would be no error as all the methods have a definition
> (whether or not they make sense in this case is a different story); it
> will still successfully load a file if any methods don't have
> definitions but will provide a warning in those situations.
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
Pasqualino "Titto" Assini, Ph.D.
More information about the Haskell-Cafe