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

Broken Eq List example #1045

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft

Broken Eq List example #1045

wants to merge 1 commit into from

Conversation

danieljharvey
Copy link
Owner

Generating instances for this test causes an infinite loop to happen.

type List a = Cons a (List a) | Nil

instance Eq Bool {
  \a -> \b -> a == b
}

instance (Eq a) => Eq (List a) {
    \listA -> \listB -> case ((listA, listB)) {
        (Nil, Nil) -> True,
        (Cons a as, Cons b bs) ->
                          if (equals a b) then (equals as bs) else False,
        _ -> False }
        }

/* you need this there to ensure the instance is created */
test "whoa" { equals (Nil : List Bool) (Nil : List Bool) }

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

Successfully merging this pull request may close these issues.

None yet

1 participant