Skip to content

Comments

Broken Eq List example#1045

Draft
danieljharvey wants to merge 1 commit intotrunkfrom
djh/fix-eq-list
Draft

Broken Eq List example#1045
danieljharvey wants to merge 1 commit intotrunkfrom
djh/fix-eq-list

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.

1 participant