
I didn't test the OP's example. But if I do let x = y ; y = x in GHCi and then run 'x', i can interrupt it with ^C. As I understand the bug is that you cannot interrupt the infinite loop in this special case. Btw. I thought instance Show Test where -- empty body should not work. An instance with no declaration should be just instance Show Test -- no body Maybe the EOF after the 'where' has something todo with this "bug". Bastian On Nov 16, 2010, at 13:17, Thomas Davie wrote:
To explain that further as to why it's not a bug...
GHCi's job is to run the code you enter. You asked it to show a value, so it executed the show function (correctly). The default implementation called showPrec, which invoked show, etc.
There may well be a missing feature here (to check of you implement nothing other than the defaults which are very likely to loop), but not a bug.
Bob
On 16 Nov 2010, at 11:44, Ozgur Akgun wrote:
Unfortunately, yes.
On 16 November 2010 11:39, Russ Abbott
wrote: I'm not sure what you are saying here. Are you saying that it's not a bug that GHCi went into a coma when I file was loaded and a prompt entered? -- Russ
On Tue, Nov 16, 2010 at 3:34 AM, Ozgur Akgun
wrote: On 16 November 2010 05:12, Russ Abbott
wrote: I know the code isn't correct. My point is that the compiler didn't complain when the code was loaded, and the interpreter died when it was executed. That shouldn't happen. -- Russ
It would be cool for GHC to make an analysis about the instance methods of a type class, and their default implementations to find the minimal subset of methods you have to implement to get a valid (for some definition of valid) instance declaration. But it doesn't do such a thing. And it is not an easy task.
GHC only warns you if you do not implement a method which doesn't have a default implementation. In your example, this is not the case.
Best,
-- Ozgur Akgun
-- Ozgur Akgun _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners