Skip to content

Stack overflow in Prelude generic tests #32

Open
@UnrelatedString

Description

@UnrelatedString

As the title says. I tried to get tests working for the Prelude, and I was mostly successful, with the caveat that the inclusion of the Generic tests causes a stack overflow in the definition of eqList. This seems more plausibly to be a bug with the backend's implementation of derive instance Generic than an issue with the Prelude itself.

Specifically,

data List a = Nil | Cons { head :: a, tail :: List a }

cons :: forall a. a -> List a -> List a
cons head tail = Cons { head, tail }

derive instance genericList :: G.Generic (List a) _

instance eqList :: Eq a => Eq (List a) where
  eq x y = GEq.genericEq x y

results in the offending definitions

M.Test_Data_Generic_Rep_eqList = function(dictEq)
  return {
    eq = M.Data_Eq_Generic_genericEq
      (M.Test_Data_Generic_Rep_genericList)  
      (M.Test_Data_Generic_Rep_genericEqSum(
        M.Data_Eq_Generic_genericEqConstructor(
          M.Data_Eq_Generic_genericEqArgument(
            M.Test_Data_Generic_Rep_eqRec(
              M.Data_Eq_eqRowCons(
                M.Test_Data_Generic_Rep_eqRowCons
                  (M.Test_Data_Generic_Rep_tailIsSymbol)
                  (M.Test_Data_Generic_Rep_eqList(dictEq))
                )
                ()
                (M.Test_Data_Generic_Rep_headIsSymbol)
                (dictEq)
              )
            )
          )
        )
      )
  }
end
M.Test_Data_Generic_Rep_eqList1 = M.Test_Data_Generic_Rep_eqList(M.Data_Eq_eqInt)

(indents added for clarity.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions