From 2d9da4b01f328094f345b8845946f7e685711d0a Mon Sep 17 00:00:00 2001 From: Yura Lazaryev Date: Sun, 30 Mar 2025 19:45:31 +0200 Subject: [PATCH] Test generic list equality --- .vscode/launch.json | 29 + .../golden/Golden/BugListGenericEq/Test.purs | 15 + .../Golden.BugListGenericEq.Test/corefn.json | 1 + .../Golden.BugListGenericEq.Test/golden.ir | 576 ++++++++++++++++++ .../Golden.BugListGenericEq.Test/golden.lua | 196 ++++++ .../Golden.BugListGenericEq.Test/main.lua | 17 + 6 files changed, 834 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 test/ps/golden/Golden/BugListGenericEq/Test.purs create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/corefn.json create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/golden.ir create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/golden.lua create mode 100644 test/ps/output/Golden.BugListGenericEq.Test/main.lua diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0ee3e12 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Lua Interpreter", + "type": "lua-local", + "request": "launch", + "scriptRoots": [ + "${workspaceFolder}/purescript-lua/test/ps/output/" + ], + "program": { + "lua": "lua", + "file": "${file}" + } + }, + { + "name": "Debug Custom Lua Environment", + "type": "lua-local", + "request": "launch", + "program": { + "command": "command" + }, + "args": [] + } + ] +} diff --git a/test/ps/golden/Golden/BugListGenericEq/Test.purs b/test/ps/golden/Golden/BugListGenericEq/Test.purs new file mode 100644 index 0000000..aa604b4 --- /dev/null +++ b/test/ps/golden/Golden/BugListGenericEq/Test.purs @@ -0,0 +1,15 @@ +module Golden.BugListGenericEq.Test where + +import Prelude +import Data.Generic.Rep as G +import Data.Eq.Generic as GEq + +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 diff --git a/test/ps/output/Golden.BugListGenericEq.Test/corefn.json b/test/ps/output/Golden.BugListGenericEq.Test/corefn.json new file mode 100644 index 0000000..89b67d1 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.15","comments":[],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqNoArguments","moduleName":["Data","Eq","Generic"]}},"type":"App"},"type":"App"},"identifier":"genericEqSum"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,27],"start":[15,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"identifier":"eqRec"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowNil","moduleName":["Data","Eq"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,27],"start":[15,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"tail"}},"type":"Abs"}]]}},"type":"App"},"type":"App"},"identifier":"eqRowCons"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"IsSymbol$Dict","moduleName":["Data","Symbol"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["reflectSymbol",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"head"}},"type":"Abs"}]]}},"type":"App"},"identifier":"headIsSymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,55],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,55],"start":[7,1]}},"constructorName":"Nil","fieldNames":[],"type":"Constructor","typeName":"List"},"identifier":"Nil"},{"annotation":{"meta":null,"sourceSpan":{"end":[7,55],"start":[7,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,55],"start":[7,1]}},"constructorName":"Cons","fieldNames":["value0"],"type":"Constructor","typeName":"List"},"identifier":"Cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Generic$Dict","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["to",{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}}],"constructorName":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]},"typeName":{"identifier":"Sum","moduleName":["Data","Generic","Rep"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[12,1]}},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}],["from",{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Golden","BugListGenericEq","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","BugListGenericEq","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Inl","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"NoArguments","moduleName":["Data","Generic","Rep"]}},"type":"App"},"type":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"binderType":"VarBinder","identifier":"arg"}],"constructorName":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]},"typeName":{"identifier":"List","moduleName":["Golden","BugListGenericEq","Test"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Inr","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Constructor","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"Argument","moduleName":["Data","Generic","Rep"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,52],"start":[12,1]}},"type":"Var","value":{"identifier":"arg","sourcePos":[12,1]}},"type":"App"},"type":"App"},"type":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"x","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"}]]}},"type":"App"},"identifier":"genericList"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[15,25],"start":[15,12]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericList","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"identifier":"genericEq"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"argument":"dictEq","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[15,29],"start":[14,1]}},"type":"Var","value":{"identifier":"Eq$Dict","moduleName":["Data","Eq"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["eq",{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[14,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEq","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqSum","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqConstructor","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"genericEqArgument","moduleName":["Data","Eq","Generic"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRec","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Data","Eq"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqRowCons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"eqList","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,27],"start":[15,12]}},"type":"Var","value":{"identifier":"undefined","moduleName":["Prim"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"headIsSymbol","moduleName":["Golden","BugListGenericEq","Test"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"dictEq","sourcePos":[0,0]}},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,27],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,27],"start":[15,26]}},"type":"Var","value":{"identifier":"x","sourcePos":[15,3]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[15,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[15,28]}},"type":"Var","value":{"identifier":"y","sourcePos":[15,3]}},"type":"App"},"type":"Abs"},"type":"Abs"}]]}},"type":"App"},"type":"Abs"},"identifier":"eqList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,40],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,40],"start":[9,1]}},"argument":"head","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,40],"start":[9,1]}},"argument":"tail","body":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,22],"start":[10,18]}},"type":"Var","value":{"identifier":"Cons","moduleName":["Golden","BugListGenericEq","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,37],"start":[10,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,37],"start":[10,23]}},"type":"Literal","value":{"literalType":"ObjectLiteral","value":[["head",{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,25]}},"type":"Var","value":{"identifier":"head","sourcePos":[10,1]}}],["tail",{"annotation":{"meta":null,"sourceSpan":{"end":[10,35],"start":[10,31]}},"type":"Var","value":{"identifier":"tail","sourcePos":[10,1]}}]]}},"type":"App"},"type":"Abs"},"type":"Abs"},"identifier":"cons"}],"exports":["Nil","Cons","cons","genericList","eqList"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Data","Eq"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Data","Eq","Generic"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Data","Generic","Rep"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Data","Symbol"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Golden","BugListGenericEq","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[3,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[15,29],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","BugListGenericEq","Test"],"modulePath":"golden/Golden/BugListGenericEq/Test.purs","reExports":{},"sourceSpan":{"end":[15,29],"start":[1,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.ir b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir new file mode 100644 index 0000000..a5fb8d6 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.ir @@ -0,0 +1,576 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.HeytingAlgebra" ) ".spago/prelude/v7.2.0/src/Data/HeytingAlgebra.purs" + [ ( Nothing, Name "boolConj" ), ( Nothing, Name "boolDisj" ), ( Nothing, Name "boolNot" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Type.Proxy", qnameName = Name "Proxy" + }, Ctor Nothing ProductType + ( ModuleName "Type.Proxy" ) + ( TyName "Proxy" ) + ( CtorName "Proxy" ) [] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Data.HeytingAlgebra", qnameName = Name "heytingAlgebraBoolean" + }, LiteralObject Nothing + [ + ( PropName "ff", LiteralBool Nothing False ), + ( PropName "tt", LiteralBool Nothing True ), + ( PropName "implies", Abs Nothing + ( ParamNamed Nothing ( Name "a" ) ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "disj" ) + ) + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "not" ) + ) + ( Ref Nothing ( Local ( Name "a" ) ) 0 ) + ) + ) + ), + ( PropName "conj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolConj" ) + ), + ( PropName "disj", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolDisj" ) + ), + ( PropName "not", ObjectProp ( Just Always ) + ( Ref Nothing + ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "foreign" ) ) 0 + ) + ( PropName "boolNot" ) + ) + ] + ) :| [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRecord" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eqRecord" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eq" }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "eq" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqRowCons" }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEqRecord" ) ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictIsSymbol" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "ra" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "rb" ) ) + ( Let Nothing + ( Standalone + ( Nothing, Name "key", App Nothing + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "dictIsSymbol" ) ) 0 ) + ( PropName "reflectSymbol" ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) :| + [ Standalone + ( Nothing, Name "get", App Nothing + ( ObjectProp ( Just Always ) + ( ForeignImport Nothing + ( ModuleName "Record.Unsafe" ) ".spago/prelude/v7.2.0/src/Record/Unsafe.purs" + [ ( Nothing, Name "unsafeGet" ) ] + ) + ( PropName "unsafeGet" ) + ) + ( Ref Nothing ( Local ( Name "key" ) ) 0 ) + ) + ] + ) + ( App Nothing + ( App Nothing + ( ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.HeytingAlgebra" ) + ( Name "heytingAlgebraBoolean" ) + ) 0 + ) + ( PropName "conj" ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "get" ) ) 0 ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eqRecord" ) ) 0 + ) + ( Ref Nothing ( Local ( Name "dictEqRecord" ) ) 0 ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Type.Proxy" ) ( Name "Proxy" ) ) 0 + ) + ) + ( Ref Nothing ( Local ( Name "ra" ) ) 0 ) + ) + ( Ref Nothing ( Local ( Name "rb" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ] + ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEq'" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dict" ) ) + ( ObjectProp Nothing ( Ref Nothing ( Local ( Name "dict" ) ) 0 ) ( PropName "genericEq'" ) ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Eq.Generic", qnameName = Name "genericEqConstructor" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", App Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Eq.Generic" ) ( Name "genericEq'" ) ) 0 ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ] + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "Nil" + }, Ctor Nothing SumType + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( TyName "List" ) + ( CtorName "Nil" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "Cons" + }, Ctor Nothing SumType + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( TyName "List" ) + ( CtorName "Cons" ) + [ FieldName "value0" ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "genericList" + }, LiteralObject Nothing + [ + ( PropName "to", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ), + ( PropName "from", Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.BugListGenericEq.Test∷List.Nil" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inl" ) + [ FieldName "value0" ] + ) + ( Ctor Nothing ProductType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "NoArguments" ) + ( CtorName "NoArguments" ) [] + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.BugListGenericEq.Test∷List.Cons" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "x" ) ) 0 ) ) + ) + ( App Nothing + ( Ctor Nothing SumType + ( ModuleName "Data.Generic.Rep" ) + ( TyName "Sum" ) + ( CtorName "Inr" ) + [ FieldName "value0" ] + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( Exception Nothing "No patterns matched" ) + ) + ) + ) + ] + ), RecursiveGroup + ( + ( QName + { qnameModuleName = ModuleName "Golden.BugListGenericEq.Test", qnameName = Name "eqList" + }, Abs Nothing + ( ParamNamed Nothing ( Name "dictEq" ) ) + ( LiteralObject Nothing + [ + ( PropName "eq", App Nothing + ( Let Nothing + ( Standalone + ( Nothing, Name "from", ObjectProp Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "genericList" ) + ) 0 + ) + ( PropName "from" ) + ) :| [] + ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "dictGenericEq" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "x" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "y" ) ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( Ref Nothing ( Local ( Name "dictGenericEq" ) ) 0 ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "x" ) ) 0 ) + ) + ) + ( App Nothing + ( Ref Nothing ( Local ( Name "from" ) ) 0 ) + ( Ref Nothing ( Local ( Name "y" ) ) 0 ) + ) + ) + ) + ) + ) + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing + ( ParamNamed Nothing ( Name "v" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "v1" ) ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inl" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ] + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v" ) ) 0 ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Data.Generic.Rep∷Sum.Inr" ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) ) + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEq'" ) + ) 0 + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq.Generic" ) + ( Name "genericEqConstructor" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "genericEq'", App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Data.Eq" ) ( Name "eq" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eq", App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRecord" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( App Nothing + ( App Nothing + ( App Nothing + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Data.Eq" ) + ( Name "eqRowCons" ) + ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "eqRecord", Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) + ( Abs Nothing ( ParamUnused Nothing ) ( LiteralBool Nothing True ) ) + ) + ) + ] + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "tail" ) + ) + ] + ) + ) + ( App Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.BugListGenericEq.Test" ) + ( Name "eqList" ) + ) 0 + ) + ( Ref Nothing + ( Local ( Name "dictEq" ) ) 0 + ) + ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Prim" ) + ( Name "undefined" ) + ) 0 + ) + ) + ( LiteralObject Nothing + [ + ( PropName "reflectSymbol", Abs Nothing ( ParamUnused Nothing ) + ( LiteralString Nothing "head" ) + ) + ] + ) + ) + ( Ref Nothing ( Local ( Name "dictEq" ) ) 0 ) + ) + ) + ( Ref Nothing + ( Imported + ( ModuleName "Type.Proxy" ) + ( Name "Proxy" ) + ) 0 + ) + ) + ] + ) + ) + ] + ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v" ) ) 0 ) + ( PropName "value0" ) + ) + ) + ( ObjectProp Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) 0 ) + ( PropName "value0" ) + ) + ) ( LiteralBool Nothing False ) + ) ( LiteralBool Nothing False ) + ) + ) + ) + ) + ] + ) + ) + ] + ) + ) :| [] + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "Nil", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Nil" ) ) 0 + ), + ( Name "Cons", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ), + ( Name "cons", Abs Nothing + ( ParamNamed Nothing ( Name "head" ) ) + ( Abs Nothing + ( ParamNamed Nothing ( Name "tail" ) ) + ( App Nothing + ( Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "Cons" ) ) 0 + ) + ( LiteralObject Nothing + [ + ( PropName "head", Ref Nothing ( Local ( Name "head" ) ) 0 ), + ( PropName "tail", Ref Nothing ( Local ( Name "tail" ) ) 0 ) + ] + ) + ) + ) + ), + ( Name "genericList", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "genericList" ) ) 0 + ), + ( Name "eqList", Ref Nothing + ( Imported ( ModuleName "Golden.BugListGenericEq.Test" ) ( Name "eqList" ) ) 0 + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.BugListGenericEq.Test/golden.lua b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua new file mode 100644 index 0000000..8e5853b --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/golden.lua @@ -0,0 +1,196 @@ +local M = {} +M.Data_HeytingAlgebra_foreign = { + boolConj = function(b1) + return function(b2) + return b1 and b2 + end + end, + boolDisj = function(b1) + return function(b2) + return b1 or b2 + end + end, + boolNot = function(b) + return not b + end +} +M.Type_Proxy_Proxy = {["$ctor"] = "Type.Proxy∷Proxy.Proxy"} +M.Data_HeytingAlgebra_heytingAlgebraBoolean = { + ff = false, + tt = true, + implies = function(a) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.disj(M.Data_HeytingAlgebra_heytingAlgebraBoolean._not_(a)) + end, + conj = M.Data_HeytingAlgebra_foreign.boolConj, + disj = M.Data_HeytingAlgebra_foreign.boolDisj, + _not_ = M.Data_HeytingAlgebra_foreign.boolNot +} +M.Data_Eq_eqRecord = function(dict) + return dict.eqRecord +end +M.Data_Eq_eq = function(dict) + return dict.eq +end +M.Data_Eq_eqRowCons = function(dictEqRecord) + return function() + return function(dictIsSymbol) + return function(dictEq) + return { + eqRecord = function() + return function(ra) + return function(rb) + local key = dictIsSymbol.reflectSymbol(M.Type_Proxy_Proxy) + local get = (function(l) + return function(r) + return r[l] + end + end)(key) + return M.Data_HeytingAlgebra_heytingAlgebraBoolean.conj(M.Data_Eq_eq(dictEq)(get(ra))(get(rb)))( + M.Data_Eq_eqRecord(dictEqRecord)(M.Type_Proxy_Proxy)(ra)(rb) + ) + end + end + end + } + end + end + end +end +M.Data_Eq_Generic_genericEqPrime = function(dict) + return dict.genericEqPrime +end +M.Data_Eq_Generic_genericEqConstructor = function(dictGenericEq) + return {genericEqPrime = M.Data_Eq_Generic_genericEqPrime(dictGenericEq)} +end +M.Golden_BugListGenericEq_Test_Nil = { + ["$ctor"] = "Golden.BugListGenericEq.Test∷List.Nil" +} +M.Golden_BugListGenericEq_Test_Cons = function(value0) + return { + ["$ctor"] = "Golden.BugListGenericEq.Test∷List.Cons", + value0 = value0 + } +end +M.Golden_BugListGenericEq_Test_genericList = { + to = function(x) + if "Data.Generic.Rep∷Sum.Inl" == x["$ctor"] then + return M.Golden_BugListGenericEq_Test_Nil + else + if "Data.Generic.Rep∷Sum.Inr" == x["$ctor"] then + return M.Golden_BugListGenericEq_Test_Cons(x.value0) + else + return error("No patterns matched") + end + end + end, + from = function(x) + if "Golden.BugListGenericEq.Test∷List.Nil" == x["$ctor"] then + return (function(value0) + return {["$ctor"] = "Data.Generic.Rep∷Sum.Inl", value0 = value0} + end)({["$ctor"] = "Data.Generic.Rep∷NoArguments.NoArguments"}) + else + if "Golden.BugListGenericEq.Test∷List.Cons" == x["$ctor"] then + return (function(value0) + return {["$ctor"] = "Data.Generic.Rep∷Sum.Inr", value0 = value0} + end)(x.value0) + else + return error("No patterns matched") + end + end + end +} +M.Golden_BugListGenericEq_Test_eqList = function(dictEq) + return { + eq = (function() + return function(dictGenericEq) + local from = M.Golden_BugListGenericEq_Test_genericList.from + return function(x) + return function(y) + return M.Data_Eq_Generic_genericEqPrime(dictGenericEq)(from(x))(from(y)) + end + end + end + end)()( + { + genericEqPrime = function(v) + return function(v1) + if "Data.Generic.Rep∷Sum.Inl" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inl" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime( + M.Data_Eq_Generic_genericEqConstructor( + { + genericEqPrime = function() + return function() + return true + end + end + } + ) + )(v.value0)(v1.value0) + else + return false + end + else + if "Data.Generic.Rep∷Sum.Inr" == v["$ctor"] then + if "Data.Generic.Rep∷Sum.Inr" == v1["$ctor"] then + return M.Data_Eq_Generic_genericEqPrime( + M.Data_Eq_Generic_genericEqConstructor( + { + genericEqPrime = M.Data_Eq_eq( + { + eq = M.Data_Eq_eqRecord( + M.Data_Eq_eqRowCons( + M.Data_Eq_eqRowCons( + { + eqRecord = function() + return function() + return function() + return true + end + end + end + } + )()( + { + reflectSymbol = function() + return "tail" + end + } + )(M.Golden_BugListGenericEq_Test_eqList(dictEq)) + )()( + { + reflectSymbol = function() + return "head" + end + } + )(dictEq) + )(M.Type_Proxy_Proxy) + } + ) + } + ) + )(v.value0)(v1.value0) + else + return false + end + else + return false + end + end + end + end + } + ) + } +end +return { + Nil = M.Golden_BugListGenericEq_Test_Nil, + Cons = M.Golden_BugListGenericEq_Test_Cons, + cons = function(head) + return function(tail) + return M.Golden_BugListGenericEq_Test_Cons({head = head, tail = tail}) + end + end, + genericList = M.Golden_BugListGenericEq_Test_genericList, + eqList = M.Golden_BugListGenericEq_Test_eqList +} diff --git a/test/ps/output/Golden.BugListGenericEq.Test/main.lua b/test/ps/output/Golden.BugListGenericEq.Test/main.lua new file mode 100644 index 0000000..7135193 --- /dev/null +++ b/test/ps/output/Golden.BugListGenericEq.Test/main.lua @@ -0,0 +1,17 @@ +-- lua test/ps/output/Golden.BugListGenericEq.Test/main.lua +local list = dofile("test/ps/output/Golden.BugListGenericEq.Test/golden.lua") +local list1 = list.cons(2)(list.cons(1)(list.Nil)) +local list2 = list.cons(2)(list.cons(1)(list.Nil)) + +local areEqual = + list.eqList( + { + eq = function(a) + return function(b) + print("Comparing: ", a, b) + return a == b + end + end + } +).eq(list1)(list2) +print("Lists are equal: ", areEqual)