(Similar to issues like #2975)
The what instance in:
class C a where
foo :: a
bar :: a
instance what :: Trivial => C Int where
foo = 0
bar = foo
class Trivial
instance trivial :: Trivial
death = foo :: Int
Is self-referencing, but the compiler doesn't pick it up and generates an infinite loop.
Usually the compiler would say something like The value of what is undefined here, so this reference is not allowed.
The call to death will cause a maximum call stack size exceeded exception.
Generated code:
var foo = function (dict) {
return dict.foo;
};
var what = function (dictTrivial) {
return new C(foo(what(dictTrivial)), 0);
};
var death = foo(what(trivial));
(Similar to issues like #2975)
The
whatinstance in:Is self-referencing, but the compiler doesn't pick it up and generates an infinite loop.
Usually the compiler would say something like
The value of what is undefined here, so this reference is not allowed.The call to
deathwill cause a maximum call stack size exceeded exception.Generated code: