Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-derived Show instance not terminating #92

Open
fiddlerwoaroof opened this issue Oct 17, 2018 · 2 comments
Open

Auto-derived Show instance not terminating #92

fiddlerwoaroof opened this issue Oct 17, 2018 · 2 comments
Labels

Comments

@fiddlerwoaroof
Copy link

Running this program (or just running (show q) in a REPL) never terminates.

#lang hackett

(data (Cons a b)
  Nil
  (Cons a (Cons b a))
  #:deriving [Show])

(def q
  (Cons 1
        (Cons "3"
              Nil)))

(main
 (println (show q)))```
@lexi-lambda
Copy link
Owner

I think this is essentially the same bug as #89, but I’m not completely sure. The issue seems to be that, when solving Show (Cons b a), the typechecker isn’t smart enough to realize it doesn’t need to solve Show (Cons a b) again, since that’s the constraint it’s currently solving, and it should simply tie the knot instead.

@fiddlerwoaroof
Copy link
Author

Yeah, I thought #89 looked similar but wasn't sure because that one involved a more complicated situation (classes + instances) while this was a fairly simple datatype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants