FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Uncaught instance self-reference · Issue #3429 · purescript/purescript · GitHub

Uncaught instance self-reference #3429

Description

(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));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL