diff --git a/changelog.d/20260713_134500_unisay_case_history_pruning.md b/changelog.d/20260713_134500_unisay_case_history_pruning.md new file mode 100644 index 00000000..ddfdf381 --- /dev/null +++ b/changelog.d/20260713_134500_unisay_case_history_pruning.md @@ -0,0 +1,11 @@ +### Changed + +- The case decision-tree compiler's match-history pruning now covers every + test, not only constructor tags: literal equality (integer, float, string, + char, boolean) and array-length tests consult the history before being + emitted, and the history accumulates every recorded outcome per scrutinee + instead of keeping a single most-recent slot. A test whose outcome is + already decided on the current path — repeated, or excluded by a mutually + exclusive sibling that passed — is pruned instead of re-emitted, removing + redundant retests and their dead branches (e.g. the nested `0 == v` retest + in `Data.String.CodePoints.codePointAt`) (#184). diff --git a/lib/Language/PureScript/Backend/IR.hs b/lib/Language/PureScript/Backend/IR.hs index fc7f56d5..04511ef0 100644 --- a/lib/Language/PureScript/Backend/IR.hs +++ b/lib/Language/PureScript/Backend/IR.hs @@ -508,8 +508,8 @@ Data: 'nestedMatches' for a constructor's or literal's fields. * 'CaseClause' is one source alternative: its outstanding 'Match'es, its result (or guarded results), and the bindings accumulated as matches pass. - * 'MatchHistory' records, per scrutinee expression, which constructor was - tested and whether the test succeeded; see the pruning paragraph. + * 'MatchHistory' records, per scrutinee expression, the outcome of every + test already performed on it; see the pruning paragraph. Pipeline: @@ -540,13 +540,16 @@ several outstanding matches, pick the one shared by the most other clauses ('countAffectedClauses'). Testing a shared sub-value first lets one test serve many clauses, which keeps the tree small. -Match-history pruning ('MatchHistory'): a constructor test on a given scrutinee -is remembered as positive or negative. A later match on the same scrutinee is -then pruned: a constructor already known to match proceeds without re-testing; -one ruled out (a sibling matched positively, or this one matched negatively) -falls straight through to the next clause. A 'ProductType' has one constructor, -so it needs no tag test at all; a 'SumType' emits the @reflectCtor == ctorId@ -test. +Match-history pruning ('MatchHistory'): every test emitted on a given +scrutinee — a constructor tag, a literal equality, an array length — is +remembered as positive or negative, and the records accumulate. A later test +on the same scrutinee is pruned when the history already decides it +('testOutcome'): a test known to have passed proceeds without re-testing; one +known to have failed, or excluded by a mutually exclusive sibling that passed +(a different tag of the same type, a different literal of the same kind, a +different array length — 'mutuallyExclusive'), falls straight through to the +next clause. A 'ProductType' has one constructor, so it needs no tag test at +all; a 'SumType' emits the @reflectCtor == ctorId@ test. -} mkCase ∷ Ann → [CfnExp] → NonEmpty (Cfn.CaseAlternative Cfn.Ann) → RepM Exp @@ -634,59 +637,38 @@ mkCaseClauses = mkClauses Map.empty (Standalone . (noAnn,,expr) <$> matchBinds) <> clauseBindings clause } + -- Emit a test for the focused pattern unless the history + -- already decides its outcome; otherwise remember the + -- outcome on both branches. + testFocus test = case testOutcome expr matchPat history of + TestKnownTrue → nextMatch history clause' + TestKnownFalse → nextClause history + TestUnknown → + ifThenElse test + <$> nextMatch (remember expr matchPat True history) clause' + <*> nextClause (remember expr matchPat False history) in case matchPat of PatAny → nextMatch history clause' PatArrayLength (intCast → len) → - ifThenElse (literalInt len `eq` arrayLength expr) - <$> nextMatch history clause' - <*> nextClause history + testFocus (literalInt len `eq` arrayLength expr) PatInteger i → - ifThenElse (literalInt i `eq` expr) - <$> nextMatch history clause' - <*> nextClause history + testFocus (literalInt i `eq` expr) PatFloating d → - ifThenElse (literalFloat d `eq` expr) - <$> nextMatch history clause' - <*> nextClause history + testFocus (literalFloat d `eq` expr) PatString s → - ifThenElse (literalString s `eq` expr) - <$> nextMatch history clause' - <*> nextClause history + testFocus (literalString s `eq` expr) PatChar c → - ifThenElse (literalChar c `eq` expr) - <$> nextMatch history clause' - <*> nextClause history + testFocus (literalChar c `eq` expr) PatBoolean b → - ifThenElse (literalBool b `eq` expr) - <$> nextMatch history clause' - <*> nextClause history - PatCtor algTy mn ty ctr → case Map.lookup expr history of - Just (ctr', True) → - if ctr' == ctr - then -- This constructor matched positively before, - -- proceed matching nested constructors. - nextMatch history clause' - else -- Other constructor matched positively before, - -- this one can't match, proceed to next clause. - nextClause history - Just (ctr', False) - | ctr' == ctr → - -- This constructor matched negatively before, - -- proceed to the next clause. - nextClause history - _ → - case algTy of - ProductType → nextMatch (history' True) clause' - SumType → - -- Either this constructor is matched for the first time, - -- or other constructor didn't pass the match before. - ifThenElse - (literalString (ctorId mn ty ctr) `eq` reflectCtor expr) - <$> nextMatch (history' True) clause' - <*> nextClause (history' False) - where - history' b = Map.insert expr (ctr, b) history + testFocus (literalBool b `eq` expr) + PatCtor algTy mn ty ctr → case algTy of + -- A product type has a single constructor: the tag test + -- is a tautology, nothing to emit or remember. + ProductType → nextMatch history clause' + SumType → + testFocus + (literalString (ctorId mn ty ctr) `eq` reflectCtor expr) where nextMatch hist clause = mkClause hist clause heuristic nextClause @@ -745,7 +727,7 @@ data Pattern | PatChar Char | PatBoolean Bool | PatArrayLength Int - deriving stock (Eq, Show) + deriving stock (Eq, Ord, Show) data Step = TakeIndex Natural @@ -873,7 +855,46 @@ mkBinder matchExp = go mempty } -- See Note [Compiling case expressions to decision trees] (history pruning) -type MatchHistory = Map Exp (CtorName, Bool) +type MatchHistory = Map Exp (Map Pattern Bool) + +data TestOutcome = TestKnownTrue | TestKnownFalse | TestUnknown + +{- | What the accumulated 'MatchHistory' already implies about testing +a pattern against a scrutinee: a repeated test keeps its recorded +outcome, and a positive outcome of a mutually exclusive sibling test +decides this one negatively. +-} +testOutcome ∷ Exp → Pattern → MatchHistory → TestOutcome +testOutcome scrutinee pat history = + case Map.lookup scrutinee history of + Nothing → TestUnknown + Just tests → case Map.lookup pat tests of + Just True → TestKnownTrue + Just False → TestKnownFalse + Nothing + | any (mutuallyExclusive pat) positives → TestKnownFalse + | otherwise → TestUnknown + where + positives = Map.keys (Map.filter id tests) + +remember ∷ Exp → Pattern → Bool → MatchHistory → MatchHistory +remember scrutinee pat outcome = + Map.insertWith Map.union scrutinee (Map.singleton pat outcome) + +{- | Whether two pattern tests on the same scrutinee cannot both +succeed: a value equals at most one literal of its kind, carries at +most one constructor tag, and an array has exactly one length. +-} +mutuallyExclusive ∷ Pattern → Pattern → Bool +mutuallyExclusive = curry \case + (PatCtor _ _ _ c1, PatCtor _ _ _ c2) → c1 /= c2 + (PatInteger a, PatInteger b) → a /= b + (PatFloating a, PatFloating b) → a /= b + (PatString a, PatString b) → a /= b + (PatChar a, PatChar b) → a /= b + (PatBoolean a, PatBoolean b) → a /= b + (PatArrayLength a, PatArrayLength b) → a /= b + _ → False alternativeToClauses ∷ [Exp] → Cfn.CaseAlternative Cfn.Ann → RepM CaseClause diff --git a/test/Language/PureScript/Backend/IR/Spec.hs b/test/Language/PureScript/Backend/IR/Spec.hs index 3a72e811..a5eb6b6d 100644 --- a/test/Language/PureScript/Backend/IR/Spec.hs +++ b/test/Language/PureScript/Backend/IR/Spec.hs @@ -558,11 +558,9 @@ spec = describe "IR representation" do case 'x', 'y' of if 'a' == 'x' then 'a', 'b' -> 1 ==> if 'b' == 'y' then 'e', _ -> 0 1 - else - if 'e' == 'x' then - 0 - else - exception "no patterns matched" + else -- 'e' == 'x' is excluded by + -- the positive 'a' == 'x' + exception "no patterns matched" else if 'e' == 'x' then 0 @@ -593,11 +591,7 @@ spec = describe "IR representation" do ( ifThenElse (literalChar 'b' `eq` literalChar 'y') (literalInt 1) - ( ifThenElse - (literalChar 'e' `eq` literalChar 'x') - (literalInt 0) - (exception "No patterns matched") - ) + (exception "No patterns matched") ) ( ifThenElse (literalChar 'e' `eq` literalChar 'x') diff --git a/test/ps/output/Golden.CasePruning.Test/corefn.json b/test/ps/output/Golden.CasePruning.Test/corefn.json new file mode 100644 index 00000000..0986b8cb --- /dev/null +++ b/test/ps/output/Golden.CasePruning.Test/corefn.json @@ -0,0 +1 @@ +{"builtWith":"0.15.16","comments":[{"LineComment":" @inline export literalRetest never"},{"LineComment":" @inline export ctorRetest never"},{"LineComment":" @inline export literalNegatives never"}],"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,31],"start":[40,3]}},"type":"Var","value":{"identifier":"discard","moduleName":["Control","Bind"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discardUnit","moduleName":["Control","Bind"]}},"type":"App"},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"bindEffect","moduleName":["Effect"]}},"type":"App"},"identifier":"discard"},{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[40,10],"start":[40,3]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Effect","Console"]}},"annotation":{"meta":{"metaType":"IsSyntheticApp"},"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"showInt","moduleName":["Data","Show"]}},"type":"App"},"identifier":"logShow"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"constructorName":"A","fieldNames":[],"type":"Constructor","typeName":"T"},"identifier":"A"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"constructorName":"B","fieldNames":[],"type":"Constructor","typeName":"T"},"identifier":"B"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,19],"start":[19,1]}},"constructorName":"C","fieldNames":[],"type":"Constructor","typeName":"T"},"identifier":"C"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,38],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,38],"start":[14,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,38],"start":[14,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,38],"start":[14,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,16],"start":[15,15]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,19],"start":[15,17]}},"binderType":"LiteralBinder","literal":{"literalType":"StringLiteral","value":""}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,22]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[16,16],"start":[16,15]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}},{"annotation":{"meta":null,"sourceSpan":{"end":[16,18],"start":[16,17]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,22],"start":[16,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,16],"start":[17,15]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,17]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,22],"start":[17,21]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[15,23],"start":[15,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"literalRetest"},{"annotation":{"meta":null,"sourceSpan":{"end":[32,38],"start":[32,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[32,38],"start":[32,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[32,38],"start":[32,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[32,38],"start":[32,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[33,19],"start":[33,18]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[33,21],"start":[33,20]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[33,25],"start":[33,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[34,19],"start":[34,18]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}},{"annotation":{"meta":null,"sourceSpan":{"end":[34,21],"start":[34,20]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[34,25],"start":[34,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[35,19],"start":[35,18]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}},{"annotation":{"meta":null,"sourceSpan":{"end":[35,21],"start":[35,20]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[35,25],"start":[35,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,19],"start":[36,18]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[36,21],"start":[36,20]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,25],"start":[36,24]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[33,25],"start":[33,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[33,25],"start":[33,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"literalNegatives"},{"annotation":{"meta":null,"sourceSpan":{"end":[24,28],"start":[24,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,28],"start":[24,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,28],"start":[24,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[24,28],"start":[24,1]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[25,13],"start":[25,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[25,15],"start":[25,14]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[25,19],"start":[25,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[26,13],"start":[26,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[26,15],"start":[26,14]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[26,19],"start":[26,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[27,13],"start":[27,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[27,15],"start":[27,14]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]},"typeName":{"identifier":"T","moduleName":["Golden","CasePruning","Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[27,19],"start":[27,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[28,13],"start":[28,12]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[28,15],"start":[28,14]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[28,19],"start":[28,18]}},"type":"Literal","value":{"literalType":"IntLiteral","value":4}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[25,19],"start":[25,1]}},"type":"Var","value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[25,19],"start":[25,1]}},"type":"Var","value":{"identifier":"v1","sourcePos":[0,0]}}],"type":"Case"},"type":"Abs"},"type":"Abs"},"identifier":"ctorRetest"},{"annotation":{"meta":null,"sourceSpan":{"end":[38,20],"start":[38,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[40,25],"start":[40,12]}},"type":"Var","value":{"identifier":"literalRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,27],"start":[40,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,27],"start":[40,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,30],"start":[40,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,30],"start":[40,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":""}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,31],"start":[40,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,25],"start":[41,12]}},"type":"Var","value":{"identifier":"literalRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,27],"start":[41,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":0}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,31],"start":[41,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,31],"start":[41,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":"x"}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,32],"start":[41,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,31],"start":[42,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,31],"start":[42,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,25],"start":[42,12]}},"type":"Var","value":{"identifier":"literalRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,27],"start":[42,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,27],"start":[42,26]}},"type":"Literal","value":{"literalType":"IntLiteral","value":5}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[42,30],"start":[42,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,30],"start":[42,28]}},"type":"Literal","value":{"literalType":"StringLiteral","value":""}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[42,31],"start":[42,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,31],"start":[42,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,27],"start":[43,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,27],"start":[43,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[43,22],"start":[43,12]}},"type":"Var","value":{"identifier":"ctorRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[43,24],"start":[43,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[43,24],"start":[43,23]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,26],"start":[43,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[43,26],"start":[43,25]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[43,27],"start":[43,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[43,27],"start":[43,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[44,27],"start":[44,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[44,27],"start":[44,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[44,22],"start":[44,12]}},"type":"Var","value":{"identifier":"ctorRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[44,24],"start":[44,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[44,24],"start":[44,23]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[44,26],"start":[44,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[44,26],"start":[44,25]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[44,27],"start":[44,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[44,27],"start":[44,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,27],"start":[45,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,27],"start":[45,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,22],"start":[45,12]}},"type":"Var","value":{"identifier":"ctorRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,24],"start":[45,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[45,24],"start":[45,23]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[45,26],"start":[45,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[45,26],"start":[45,25]}},"type":"Var","value":{"identifier":"B","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[45,27],"start":[45,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,27],"start":[45,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[46,27],"start":[46,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[46,27],"start":[46,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[46,22],"start":[46,12]}},"type":"Var","value":{"identifier":"ctorRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[46,24],"start":[46,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[46,24],"start":[46,23]}},"type":"Var","value":{"identifier":"A","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[46,26],"start":[46,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[46,26],"start":[46,25]}},"type":"Var","value":{"identifier":"C","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[46,27],"start":[46,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[46,27],"start":[46,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[47,27],"start":[47,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[47,27],"start":[47,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[47,22],"start":[47,12]}},"type":"Var","value":{"identifier":"ctorRetest","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[47,24],"start":[47,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[47,24],"start":[47,23]}},"type":"Var","value":{"identifier":"C","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[47,26],"start":[47,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[47,26],"start":[47,25]}},"type":"Var","value":{"identifier":"C","moduleName":["Golden","CasePruning","Test"]}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[47,27],"start":[47,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[47,27],"start":[47,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,33],"start":[48,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,33],"start":[48,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[48,28],"start":[48,12]}},"type":"Var","value":{"identifier":"literalNegatives","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,30],"start":[48,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,30],"start":[48,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,32],"start":[48,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,32],"start":[48,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,33],"start":[48,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,33],"start":[48,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[49,33],"start":[49,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[49,33],"start":[49,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[49,28],"start":[49,12]}},"type":"Var","value":{"identifier":"literalNegatives","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[49,30],"start":[49,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[49,30],"start":[49,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[49,32],"start":[49,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[49,32],"start":[49,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[49,33],"start":[49,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[49,33],"start":[49,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[50,33],"start":[50,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[50,33],"start":[50,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[50,28],"start":[50,12]}},"type":"Var","value":{"identifier":"literalNegatives","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[50,30],"start":[50,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[50,30],"start":[50,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[50,32],"start":[50,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[50,32],"start":[50,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":2}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[50,33],"start":[50,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[50,33],"start":[50,3]}},"argument":"$__unused","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"discard","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[51,28],"start":[51,12]}},"type":"Var","value":{"identifier":"literalNegatives","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[51,30],"start":[51,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[51,30],"start":[51,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":1}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[51,32],"start":[51,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[51,32],"start":[51,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"type":"App"},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,3]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"type":"Var","value":{"identifier":"logShow","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[52,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[52,28],"start":[52,12]}},"type":"Var","value":{"identifier":"literalNegatives","moduleName":["Golden","CasePruning","Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,30],"start":[52,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,30],"start":[52,29]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[52,32],"start":[52,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,32],"start":[52,31]}},"type":"Literal","value":{"literalType":"IntLiteral","value":3}},"type":"App"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"type":"Abs"},"type":"App"},"identifier":"main"}],"exports":["literalRetest","A","B","C","ctorRetest","literalNegatives","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Control","Bind"]},{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Data","Show"]},{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Effect"]},{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Effect","Console"]},{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Golden","CasePruning","Test"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[52,33],"start":[4,1]}},"moduleName":["Prim"]}],"moduleName":["Golden","CasePruning","Test"],"modulePath":"src/Golden/CasePruning/Test.purs","reExports":{},"sourceSpan":{"end":[52,33],"start":[4,1]}} \ No newline at end of file diff --git a/test/ps/output/Golden.CasePruning.Test/eval/.gitignore b/test/ps/output/Golden.CasePruning.Test/eval/.gitignore new file mode 100644 index 00000000..d2dc29bb --- /dev/null +++ b/test/ps/output/Golden.CasePruning.Test/eval/.gitignore @@ -0,0 +1 @@ +actual.txt diff --git a/test/ps/output/Golden.CasePruning.Test/eval/golden.txt b/test/ps/output/Golden.CasePruning.Test/eval/golden.txt new file mode 100644 index 00000000..9d820012 --- /dev/null +++ b/test/ps/output/Golden.CasePruning.Test/eval/golden.txt @@ -0,0 +1,13 @@ +1 +2 +3 +1 +2 +3 +4 +4 +1 +2 +3 +4 +4 diff --git a/test/ps/output/Golden.CasePruning.Test/golden.ir b/test/ps/output/Golden.CasePruning.Test/golden.ir new file mode 100644 index 00000000..8f668cce --- /dev/null +++ b/test/ps/output/Golden.CasePruning.Test/golden.ir @@ -0,0 +1,470 @@ +UberModule + { uberModuleBindings = + [ Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Data.Show" ) ".spago/p/prelude/5718c84fdde6247749cb053e816df696c30fe691/src/Data/Show.purs" + [ ( Nothing, Name "showIntImpl" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Data.Show", qnameName = Name "showIntImpl" + }, ObjectProp Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "foreign" ) ) ) + ( PropName "showIntImpl" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "foreign" + }, ForeignImport Nothing + ( ModuleName "Effect.Console" ) ".spago/p/console/f82835a0b873aafe6bd7b14dd30cc150553d4ab9/src/Effect/Console.purs" + [ ( Nothing, Name "log" ) ] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "log" + }, ObjectProp Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "foreign" ) ) ) + ( PropName "log" ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "A" + }, Ctor Nothing SumType + ( ModuleName "Golden.CasePruning.Test" ) + ( TyName "T" ) + ( CtorName "A" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "B" + }, Ctor Nothing SumType + ( ModuleName "Golden.CasePruning.Test" ) + ( TyName "T" ) + ( CtorName "B" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "C" + }, Ctor Nothing SumType + ( ModuleName "Golden.CasePruning.Test" ) + ( TyName "T" ) + ( CtorName "C" ) [] + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "literalRetest" + }, AbsN ( Just Never ) + ( ParamNamed Nothing ( Name "v" ) :| [] ) + ( AbsN Nothing + ( ParamNamed Nothing ( Name "v1" ) :| [] ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralString Nothing "" ) ( Ref Nothing ( Local ( Name "v1" ) ) ) ) + ( LiteralInt Nothing 1 ) + ( LiteralInt Nothing 2 ) + ) + ( LiteralInt Nothing 3 ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "literalNegatives" + }, AbsN ( Just Never ) + ( ParamNamed Nothing ( Name "v" ) :| [] ) + ( AbsN Nothing + ( ParamNamed Nothing ( Name "v1" ) :| [] ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v" ) ) ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 1 ) ( Ref Nothing ( Local ( Name "v1" ) ) ) ) + ( LiteralInt Nothing 1 ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 2 ) ( Ref Nothing ( Local ( Name "v1" ) ) ) ) + ( LiteralInt Nothing 3 ) + ( LiteralInt Nothing 4 ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 2 ) ( Ref Nothing ( Local ( Name "v" ) ) ) ) + ( IfThenElse Nothing + ( Eq Nothing ( LiteralInt Nothing 2 ) ( Ref Nothing ( Local ( Name "v1" ) ) ) ) + ( LiteralInt Nothing 2 ) + ( LiteralInt Nothing 4 ) + ) + ( LiteralInt Nothing 4 ) + ) + ) + ) + ), Standalone + ( QName + { qnameModuleName = ModuleName "Golden.CasePruning.Test", qnameName = Name "ctorRetest" + }, AbsN ( Just Never ) + ( ParamNamed Nothing ( Name "v" ) :| [] ) + ( AbsN Nothing + ( ParamNamed Nothing ( Name "v1" ) :| [] ) + ( Let Nothing + ( Standalone + ( Nothing, Name "$cse223", ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v1" ) ) ) + ) :| [] + ) + ( Let Nothing + ( Standalone + ( Nothing, Name "$cse222", ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v" ) ) ) + ) :| [] + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.CasePruning.Test∷T.A" ) + ( Ref Nothing ( Local ( Name "$cse222" ) ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.CasePruning.Test∷T.A" ) + ( Ref Nothing ( Local ( Name "$cse223" ) ) ) + ) + ( LiteralInt Nothing 1 ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.CasePruning.Test∷T.B" ) + ( Ref Nothing ( Local ( Name "$cse223" ) ) ) + ) + ( LiteralInt Nothing 3 ) + ( LiteralInt Nothing 4 ) + ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.CasePruning.Test∷T.B" ) + ( Ref Nothing ( Local ( Name "$cse222" ) ) ) + ) + ( IfThenElse Nothing + ( Eq Nothing + ( LiteralString Nothing "Golden.CasePruning.Test∷T.B" ) + ( Ref Nothing ( Local ( Name "$cse223" ) ) ) + ) + ( LiteralInt Nothing 2 ) + ( LiteralInt Nothing 4 ) + ) + ( LiteralInt Nothing 4 ) + ) + ) + ) + ) + ) + ) + ], uberModuleForeigns = [], uberModuleExports = + [ + ( Name "literalRetest", Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "literalRetest" ) ) + ), + ( Name "A", Ref Nothing ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "A" ) ) ), + ( Name "B", Ref Nothing ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "B" ) ) ), + ( Name "C", Ref Nothing ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "C" ) ) ), + ( Name "ctorRetest", Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "ctorRetest" ) ) + ), + ( Name "literalNegatives", Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "literalNegatives" ) ) + ), + ( Name "main", AbsN Nothing + ( ParamUnused Nothing :| [] ) + ( Let Nothing + ( Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalRetest" ) + ) + ) + ( LiteralInt Nothing 0 :| [] ) + ) + ( LiteralString Nothing "" :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ) :| + [ Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalRetest" ) + ) + ) + ( LiteralInt Nothing 0 :| [] ) + ) + ( LiteralString Nothing "x" :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalRetest" ) + ) + ) + ( LiteralInt Nothing 5 :| [] ) + ) + ( LiteralString Nothing "" :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "ctorRetest" ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "A" ) ) :| [] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "A" ) ) :| [] + ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "ctorRetest" ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "B" ) ) :| [] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "B" ) ) :| [] + ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "ctorRetest" ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "A" ) ) :| [] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "B" ) ) :| [] + ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "ctorRetest" ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "A" ) ) :| [] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "C" ) ) :| [] + ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "ctorRetest" ) + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "C" ) ) :| [] + ) + ) + ( Ref Nothing + ( Imported ( ModuleName "Golden.CasePruning.Test" ) ( Name "C" ) ) :| [] + ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalNegatives" ) + ) + ) + ( LiteralInt Nothing 1 :| [] ) + ) + ( LiteralInt Nothing 1 :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalNegatives" ) + ) + ) + ( LiteralInt Nothing 2 :| [] ) + ) + ( LiteralInt Nothing 2 :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalNegatives" ) + ) + ) + ( LiteralInt Nothing 1 :| [] ) + ) + ( LiteralInt Nothing 2 :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ), Standalone + ( Nothing, Name "_", AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalNegatives" ) + ) + ) + ( LiteralInt Nothing 1 :| [] ) + ) + ( LiteralInt Nothing 3 :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ) + ] + ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Effect.Console" ) ( Name "log" ) ) ) + ( AppN Nothing + ( Ref Nothing ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) + ( AppN Nothing + ( AppN Nothing + ( Ref Nothing + ( Imported + ( ModuleName "Golden.CasePruning.Test" ) + ( Name "literalNegatives" ) + ) + ) + ( LiteralInt Nothing 3 :| [] ) + ) + ( LiteralInt Nothing 3 :| [] ) :| [] + ) :| [] + ) + ) + ( Ref Nothing ( Imported ( ModuleName "Prim" ) ( Name "$magicDoRun" ) ) :| [] ) + ) + ) + ) + ] + } \ No newline at end of file diff --git a/test/ps/output/Golden.CasePruning.Test/golden.lua b/test/ps/output/Golden.CasePruning.Test/golden.lua new file mode 100644 index 00000000..fe9697af --- /dev/null +++ b/test/ps/output/Golden.CasePruning.Test/golden.lua @@ -0,0 +1,63 @@ +local Data_Show_foreign = { showIntImpl = function(n) return tostring(n) end } +local Data_Show_showIntImpl = Data_Show_foreign.showIntImpl +local Effect_Console_foreign = { + log = function(s) return function() print(s) end end +} +local Effect_Console_log = Effect_Console_foreign.log +local Golden_CasePruning_Test_A = { "Golden.CasePruning.Test∷T.A" } +local Golden_CasePruning_Test_B = { "Golden.CasePruning.Test∷T.B" } +local Golden_CasePruning_Test_C = { "Golden.CasePruning.Test∷T.C" } +local Golden_CasePruning_Test_literalRetest = function(v) + return function(v1) + if 0 == v then if "" == v1 then return 1 else return 2 end else return 3 end + end +end +local Golden_CasePruning_Test_literalNegatives = function(v) + return function(v1) + if 1 == v then + if 1 == v1 then return 1 elseif 2 == v1 then return 3 else return 4 end + elseif 2 == v then + if 2 == v1 then return 2 else return 4 end + else + return 4 + end + end +end +local Golden_CasePruning_Test_ctorRetest = function(v) + return function(v1) + local _S_cse223 = v1[1] + local _S_cse222 = v[1] + if "Golden.CasePruning.Test∷T.A" == _S_cse222 then + if "Golden.CasePruning.Test∷T.A" == _S_cse223 then + return 1 + elseif "Golden.CasePruning.Test∷T.B" == _S_cse223 then + return 3 + else + return 4 + end + elseif "Golden.CasePruning.Test∷T.B" == _S_cse222 then + if "Golden.CasePruning.Test∷T.B" == _S_cse223 then + return 2 + else + return 4 + end + else + return 4 + end + end +end +return (function() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalRetest(0)("")))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalRetest(0)("x")))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalRetest(5)("")))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_ctorRetest(Golden_CasePruning_Test_A)(Golden_CasePruning_Test_A)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_ctorRetest(Golden_CasePruning_Test_B)(Golden_CasePruning_Test_B)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_ctorRetest(Golden_CasePruning_Test_A)(Golden_CasePruning_Test_B)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_ctorRetest(Golden_CasePruning_Test_A)(Golden_CasePruning_Test_C)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_ctorRetest(Golden_CasePruning_Test_C)(Golden_CasePruning_Test_C)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalNegatives(1)(1)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalNegatives(2)(2)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalNegatives(1)(2)))() + local _ = Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalNegatives(1)(3)))() + return Effect_Console_log(Data_Show_showIntImpl(Golden_CasePruning_Test_literalNegatives(3)(3)))() +end)() diff --git a/test/ps/output/Golden.CaseStatements.Test/golden.ir b/test/ps/output/Golden.CaseStatements.Test/golden.ir index 0b297a20..92c6c254 100644 --- a/test/ps/output/Golden.CaseStatements.Test/golden.ir +++ b/test/ps/output/Golden.CaseStatements.Test/golden.ir @@ -16,19 +16,19 @@ UberModule ( CtorName "N" ) [] ), ( Name "d", AbsN Nothing - ( ParamNamed Nothing ( Name "m$34" ) :| [] ) + ( ParamNamed Nothing ( Name "m$10" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "n$35" ) :| [] ) + ( ParamNamed Nothing ( Name "n$11" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "x$36" ) :| [] ) + ( ParamNamed Nothing ( Name "x$12" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "v$37", AbsN Nothing + ( Nothing, Name "v$13", AbsN Nothing ( ParamUnused Nothing :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralChar Nothing 'y' ) - ( Ref Nothing ( Local ( Name "x$36" ) ) ) + ( Ref Nothing ( Local ( Name "x$12" ) ) ) ) ( LiteralInt Nothing 0 ) ( LiteralInt Nothing 1 ) @@ -38,33 +38,33 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralChar Nothing 'x' ) - ( Ref Nothing ( Local ( Name "x$36" ) ) ) + ( Ref Nothing ( Local ( Name "x$12" ) ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Golden.CaseStatements.Test∷M.J" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m$34" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "m$10" ) ) ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Golden.CaseStatements.Test∷M.N" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "n$35" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "n$11" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "m$34" ) ) ) + ( Ref Nothing ( Local ( Name "m$10" ) ) ) ) ( AppN Nothing - ( Ref Nothing ( Local ( Name "v$37" ) ) ) + ( Ref Nothing ( Local ( Name "v$13" ) ) ) ( LiteralBool Nothing True :| [] ) ) ) ( AppN Nothing - ( Ref Nothing ( Local ( Name "v$37" ) ) ) + ( Ref Nothing ( Local ( Name "v$13" ) ) ) ( LiteralBool Nothing True :| [] ) ) ) ( AppN Nothing - ( Ref Nothing ( Local ( Name "v$37" ) ) ) + ( Ref Nothing ( Local ( Name "v$13" ) ) ) ( LiteralBool Nothing True :| [] ) ) ) diff --git a/test/ps/output/Golden.CaseStatements.Test/golden.lua b/test/ps/output/Golden.CaseStatements.Test/golden.lua index 64fc1c47..667157ed 100644 --- a/test/ps/output/Golden.CaseStatements.Test/golden.lua +++ b/test/ps/output/Golden.CaseStatements.Test/golden.lua @@ -4,24 +4,24 @@ return { c = 42, J = function(value0) return { "Golden.CaseStatements.Test∷M.J", value0 } end, N = { "Golden.CaseStatements.Test∷M.N" }, - d = function(m_S_34) - return function(n_S_35) - return function(x_S_36) - local v_S_37 = function() - if "y" == x_S_36 then return 0 else return 1 end + d = function(m_S_10) + return function(n_S_11) + return function(x_S_12) + local v_S_13 = function() + if "y" == x_S_12 then return 0 else return 1 end end - if "x" == x_S_36 then - if "Golden.CaseStatements.Test∷M.J" == m_S_34[1] then - if "Golden.CaseStatements.Test∷M.N" == n_S_35[1] then - return m_S_34[2] + if "x" == x_S_12 then + if "Golden.CaseStatements.Test∷M.J" == m_S_10[1] then + if "Golden.CaseStatements.Test∷M.N" == n_S_11[1] then + return m_S_10[2] else - return v_S_37(true) + return v_S_13(true) end else - return v_S_37(true) + return v_S_13(true) end else - return v_S_37(true) + return v_S_13(true) end end end diff --git a/test/ps/output/Golden.PatternMatching.Test2/golden.ir b/test/ps/output/Golden.PatternMatching.Test2/golden.ir index ab4a5d2f..4ea6db6a 100644 --- a/test/ps/output/Golden.PatternMatching.Test2/golden.ir +++ b/test/ps/output/Golden.PatternMatching.Test2/golden.ir @@ -113,14 +113,7 @@ UberModule ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "$cse2" ) ) ) ) ) ( LiteralInt Nothing 4 ) - ( IfThenElse Nothing - ( Eq Nothing - ( LiteralString Nothing "Golden.PatternMatching.Test2∷N.Zero" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "$cse2" ) ) ) ) - ) - ( LiteralInt Nothing 5 ) - ( LiteralInt Nothing 6 ) - ) + ( LiteralInt Nothing 6 ) ) ) ) diff --git a/test/ps/output/Golden.PatternMatching.Test2/golden.lua b/test/ps/output/Golden.PatternMatching.Test2/golden.lua index c5f17e94..8b862671 100644 --- a/test/ps/output/Golden.PatternMatching.Test2/golden.lua +++ b/test/ps/output/Golden.PatternMatching.Test2/golden.lua @@ -41,8 +41,6 @@ return { return 3 elseif "Golden.PatternMatching.Test2∷N.Add" == _S_cse2[1] then return 4 - elseif "Golden.PatternMatching.Test2∷N.Zero" == _S_cse2[1] then - return 5 else return 6 end diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.ir b/test/ps/output/Golden.StringCodePoints.Test/golden.ir index feed4af7..6f1488ce 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.ir +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.ir @@ -140,12 +140,6 @@ UberModule ( Nothing, Name "_unsafeCodePointAt0" ) ] ), Standalone - ( QName - { qnameModuleName = ModuleName "Data.String.CodePoints", qnameName = Name "_codePointAt" - }, ObjectProp Nothing - ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) ) - ( PropName "_codePointAt" ) - ), Standalone ( QName { qnameModuleName = ModuleName "Effect.Console", qnameName = Name "foreign" }, ForeignImport Nothing @@ -192,28 +186,28 @@ UberModule ) ), ( PropName "conj", AbsN Nothing - ( ParamNamed Nothing ( Name "b1$1497" ) :| [] ) + ( ParamNamed Nothing ( Name "b1$1494" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "b2$1498" ) :| [] ) + ( ParamNamed Nothing ( Name "b2$1495" ) :| [] ) ( PrimBinOp Nothing PrimAnd - ( Ref Nothing ( Local ( Name "b1$1497" ) ) ) - ( Ref Nothing ( Local ( Name "b2$1498" ) ) ) + ( Ref Nothing ( Local ( Name "b1$1494" ) ) ) + ( Ref Nothing ( Local ( Name "b2$1495" ) ) ) ) ) ), ( PropName "disj", AbsN Nothing - ( ParamNamed Nothing ( Name "b1$1495" ) :| [] ) + ( ParamNamed Nothing ( Name "b1$1492" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "b2$1496" ) :| [] ) + ( ParamNamed Nothing ( Name "b2$1493" ) :| [] ) ( PrimBinOp Nothing PrimOr - ( Ref Nothing ( Local ( Name "b1$1495" ) ) ) - ( Ref Nothing ( Local ( Name "b2$1496" ) ) ) + ( Ref Nothing ( Local ( Name "b1$1492" ) ) ) + ( Ref Nothing ( Local ( Name "b2$1493" ) ) ) ) ) ), ( PropName "not", AbsN Nothing - ( ParamNamed Nothing ( Name "b$1494" ) :| [] ) - ( PrimNot Nothing ( Ref Nothing ( Local ( Name "b$1494" ) ) ) ) + ( ParamNamed Nothing ( Name "b$1491" ) :| [] ) + ( PrimNot Nothing ( Ref Nothing ( Local ( Name "b$1491" ) ) ) ) ) ] ) :| [] @@ -222,12 +216,12 @@ UberModule { qnameModuleName = ModuleName "Data.Eq", qnameName = Name "eqInt" }, LiteralObject Nothing [ ( PropName "eq", AbsN Nothing - ( ParamNamed Nothing ( Name "r1$1490" ) :| [] ) + ( ParamNamed Nothing ( Name "r1$1487" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "r2$1491" ) :| [] ) + ( ParamNamed Nothing ( Name "r2$1488" ) :| [] ) ( Eq Nothing - ( Ref Nothing ( Local ( Name "r1$1490" ) ) ) - ( Ref Nothing ( Local ( Name "r2$1491" ) ) ) + ( Ref Nothing ( Local ( Name "r1$1487" ) ) ) + ( Ref Nothing ( Local ( Name "r2$1488" ) ) ) ) ) ) @@ -268,19 +262,19 @@ UberModule }, LiteralObject Nothing [ ( PropName "compare", AbsN Nothing - ( ParamNamed Nothing ( Name "x$1474" ) :| [] ) + ( ParamNamed Nothing ( Name "x$1471" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "y$1475" ) :| [] ) + ( ParamNamed Nothing ( Name "y$1472" ) :| [] ) ( IfThenElse Nothing ( PrimBinOp Nothing PrimLt - ( Ref Nothing ( Local ( Name "x$1474" ) ) ) - ( Ref Nothing ( Local ( Name "y$1475" ) ) ) + ( Ref Nothing ( Local ( Name "x$1471" ) ) ) + ( Ref Nothing ( Local ( Name "y$1472" ) ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "LT" ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( Ref Nothing ( Local ( Name "x$1474" ) ) ) - ( Ref Nothing ( Local ( Name "y$1475" ) ) ) + ( Ref Nothing ( Local ( Name "x$1471" ) ) ) + ( Ref Nothing ( Local ( Name "y$1472" ) ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "EQ" ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "GT" ) ) ) @@ -410,10 +404,10 @@ UberModule ( PropName "_unsafeCodePointAt0" ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "s$27" ) :| [] ) + ( ParamNamed Nothing ( Name "s$24" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "cu0$28", AppN Nothing + ( Nothing, Name "cu0$25", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromEnum" ) ) ) @@ -424,7 +418,7 @@ UberModule ) ( LiteralInt Nothing 0 :| [] ) ) - ( Ref Nothing ( Local ( Name "s$27" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "s$24" ) ) :| [] ) :| [] ) ) :| [] ) @@ -445,7 +439,7 @@ UberModule ) ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| - [ LiteralInt Nothing 55296, Ref Nothing ( Local ( Name "cu0$28" ) ) ] + [ LiteralInt Nothing 55296, Ref Nothing ( Local ( Name "cu0$25" ) ) ] ) :| [] ) ) @@ -455,7 +449,7 @@ UberModule ) ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| - [ Ref Nothing ( Local ( Name "cu0$28" ) ), LiteralInt Nothing 56319 ] + [ Ref Nothing ( Local ( Name "cu0$25" ) ), LiteralInt Nothing 56319 ] ) :| [] ) :| [] ) @@ -466,27 +460,27 @@ UberModule ( AppN Nothing ( Let Nothing ( Standalone - ( Nothing, Name "x$1588", AppN Nothing + ( Nothing, Name "x$1585", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodeUnits" ) ( Name "length" ) ) ) - ( Ref Nothing ( Local ( Name "s$27" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "s$24" ) ) :| [] ) ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "y$1589" ) :| [] ) + ( ParamNamed Nothing ( Name "y$1586" ) :| [] ) ( IfThenElse Nothing ( PrimBinOp Nothing PrimLt - ( Ref Nothing ( Local ( Name "x$1588" ) ) ) - ( Ref Nothing ( Local ( Name "y$1589" ) ) ) + ( Ref Nothing ( Local ( Name "x$1585" ) ) ) + ( Ref Nothing ( Local ( Name "y$1586" ) ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "LT" ) ) ) ( IfThenElse Nothing ( Eq Nothing - ( Ref Nothing ( Local ( Name "x$1588" ) ) ) - ( Ref Nothing ( Local ( Name "y$1589" ) ) ) + ( Ref Nothing ( Local ( Name "x$1585" ) ) ) + ( Ref Nothing ( Local ( Name "y$1586" ) ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Ordering" ) ( Name "EQ" ) ) @@ -505,7 +499,7 @@ UberModule ) ( Let Nothing ( Standalone - ( Nothing, Name "cu1$30", AppN Nothing + ( Nothing, Name "cu1$27", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "fromEnum" ) ) ) @@ -516,7 +510,7 @@ UberModule ) ( LiteralInt Nothing 1 :| [] ) ) - ( Ref Nothing ( Local ( Name "s$27" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "s$24" ) ) :| [] ) :| [] ) ) :| [] ) @@ -532,7 +526,7 @@ UberModule ) ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| - [ LiteralInt Nothing 56320, Ref Nothing ( Local ( Name "cu1$30" ) ) ] + [ LiteralInt Nothing 56320, Ref Nothing ( Local ( Name "cu1$27" ) ) ] ) :| [] ) ) @@ -542,7 +536,7 @@ UberModule ) ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| - [ Ref Nothing ( Local ( Name "cu1$30" ) ), LiteralInt Nothing 57343 ] + [ Ref Nothing ( Local ( Name "cu1$27" ) ), LiteralInt Nothing 57343 ] ) :| [] ) ) @@ -550,22 +544,22 @@ UberModule ( PrimBinOp Nothing PrimAdd ( PrimBinOp Nothing PrimMul ( PrimBinOp Nothing PrimSub - ( Ref Nothing ( Local ( Name "cu0$28" ) ) ) + ( Ref Nothing ( Local ( Name "cu0$25" ) ) ) ( LiteralInt Nothing 55296 ) ) ( LiteralInt Nothing 1024 ) ) ( PrimBinOp Nothing PrimSub - ( Ref Nothing ( Local ( Name "cu1$30" ) ) ) + ( Ref Nothing ( Local ( Name "cu1$27" ) ) ) ( LiteralInt Nothing 56320 ) ) ) ( LiteralInt Nothing 65536 ) ) - ( Ref Nothing ( Local ( Name "cu0$28" ) ) ) + ( Ref Nothing ( Local ( Name "cu0$25" ) ) ) ) ) - ( Ref Nothing ( Local ( Name "cu0$28" ) ) ) + ( Ref Nothing ( Local ( Name "cu0$25" ) ) ) ) ) :| [] ) @@ -576,7 +570,7 @@ UberModule ( ParamNamed Nothing ( Name "v" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "$cse1761", ObjectProp Nothing + ( Nothing, Name "$cse1758", ObjectProp Nothing ( Ref Nothing ( Imported ( ModuleName "Data.HeytingAlgebra" ) ( Name "heytingAlgebraBoolean" ) ) ) @@ -597,10 +591,10 @@ UberModule ) ( Let Nothing ( Standalone - ( Nothing, Name "v$1749", IfThenElse Nothing + ( Nothing, Name "v$1746", IfThenElse Nothing ( AppN Nothing ( AppN Nothing - ( Ref Nothing ( Local ( Name "$cse1761" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1758" ) ) ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "greaterThanOrEq$w" ) ) @@ -652,15 +646,15 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1749" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1746" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1749" ) ) ) + ( Ref Nothing ( Local ( Name "v$1746" ) ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1749" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1746" ) ) ) ) ) ( IfThenElse Nothing ( AppN Nothing @@ -693,7 +687,7 @@ UberModule ( PrimBinOp Nothing PrimConcat ( Let Nothing ( Standalone - ( Nothing, Name "x$1750", PrimBinOp Nothing PrimAdd + ( Nothing, Name "x$1747", PrimBinOp Nothing PrimAdd ( AppN Nothing ( AppN Nothing ( ObjectProp Nothing @@ -718,10 +712,10 @@ UberModule ) ( Let Nothing ( Standalone - ( Nothing, Name "v$1751", IfThenElse Nothing + ( Nothing, Name "v$1748", IfThenElse Nothing ( AppN Nothing ( AppN Nothing - ( Ref Nothing ( Local ( Name "$cse1761" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1758" ) ) ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "greaterThanOrEq$w" ) ) @@ -729,7 +723,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1750" ) ), AppN Nothing + ( Local ( Name "x$1747" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -747,7 +741,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1750" ) ), AppN Nothing + ( Local ( Name "x$1747" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -764,7 +758,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromCharCode" ) ) ) - ( Ref Nothing ( Local ( Name "x$1750" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "x$1747" ) ) :| [] ) :| [] ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) ) @@ -773,15 +767,15 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1751" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1748" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1751" ) ) ) + ( Ref Nothing ( Local ( Name "v$1748" ) ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1751" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1748" ) ) ) ) ) ( IfThenElse Nothing ( AppN Nothing @@ -791,7 +785,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1750" ) ), AppN Nothing + ( Local ( Name "x$1747" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -819,7 +813,7 @@ UberModule ) ( Let Nothing ( Standalone - ( Nothing, Name "x$1752", PrimBinOp Nothing PrimAdd + ( Nothing, Name "x$1749", PrimBinOp Nothing PrimAdd ( AppN Nothing ( AppN Nothing ( ObjectProp Nothing @@ -844,10 +838,10 @@ UberModule ) ( Let Nothing ( Standalone - ( Nothing, Name "v$1753", IfThenElse Nothing + ( Nothing, Name "v$1750", IfThenElse Nothing ( AppN Nothing ( AppN Nothing - ( Ref Nothing ( Local ( Name "$cse1761" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1758" ) ) ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "greaterThanOrEq$w" ) ) @@ -855,7 +849,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1752" ) ), AppN Nothing + ( Local ( Name "x$1749" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -873,7 +867,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1752" ) ), AppN Nothing + ( Local ( Name "x$1749" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -890,7 +884,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "fromCharCode" ) ) ) - ( Ref Nothing ( Local ( Name "x$1752" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "x$1749" ) ) :| [] ) :| [] ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) ) @@ -899,15 +893,15 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1753" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1750" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1753" ) ) ) + ( Ref Nothing ( Local ( Name "v$1750" ) ) ) ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1753" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1750" ) ) ) ) ) ( IfThenElse Nothing ( AppN Nothing @@ -917,7 +911,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.Ord" ) ( Name "ordInt" ) ) :| [ Ref Nothing - ( Local ( Name "x$1752" ) ), AppN Nothing + ( Local ( Name "x$1749" ) ), AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Enum" ) ( Name "toCharCode" ) ) ) @@ -988,12 +982,12 @@ UberModule ( LiteralObject Nothing [ ( PropName "eq", AbsN Nothing - ( ParamNamed Nothing ( Name "x$20" ) :| [] ) + ( ParamNamed Nothing ( Name "x$17" ) :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "y$21" ) :| [] ) + ( ParamNamed Nothing ( Name "y$18" ) :| [] ) ( Eq Nothing - ( Ref Nothing ( Local ( Name "x$20" ) ) ) - ( Ref Nothing ( Local ( Name "y$21" ) ) ) + ( Ref Nothing ( Local ( Name "x$17" ) ) ) + ( Ref Nothing ( Local ( Name "y$18" ) ) ) ) ) ) @@ -1058,7 +1052,7 @@ UberModule ( LiteralString Nothing "" ) ( Let Nothing ( Standalone - ( Nothing, Name "v2$17", AppN Nothing + ( Nothing, Name "v2$14", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) ) @@ -1068,7 +1062,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2$17" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v2$14" ) ) ) ) ) ( PrimBinOp Nothing PrimConcat ( AppN Nothing @@ -1077,7 +1071,7 @@ UberModule ) ( ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v2$17" ) ) ) + ( Ref Nothing ( Local ( Name "v2$14" ) ) ) ) ( PropName "head" ) :| [] ) @@ -1094,7 +1088,7 @@ UberModule ( LiteralInt Nothing 1 ) :| [ ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v2$17" ) ) ) + ( Ref Nothing ( Local ( Name "v2$14" ) ) ) ) ( PropName "tail" ) ] @@ -1189,7 +1183,7 @@ UberModule ( PropName "_toCodePointArray" ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "s$10" ) :| [] ) + ( ParamNamed Nothing ( Name "s$7" ) :| [] ) ( AppN Nothing ( AppN Nothing ( AppN Nothing @@ -1203,22 +1197,22 @@ UberModule ( PropName "unfoldrArrayImpl" ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v2$1519" ) :| [] ) + ( ParamNamed Nothing ( Name "v2$1516" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "$cse1762", ReflectCtor Nothing - ( Ref Nothing ( Local ( Name "v2$1519" ) ) ) + ( Nothing, Name "$cse1759", ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v2$1516" ) ) ) ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( Ref Nothing ( Local ( Name "$cse1762" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1759" ) ) ) ) ( LiteralBool Nothing True ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( Ref Nothing ( Local ( Name "$cse1762" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1759" ) ) ) ) ( LiteralBool Nothing False ) ( Exception Nothing "No patterns matched" ) ) @@ -1233,14 +1227,14 @@ UberModule ( AbsN Nothing ( ParamUnused Nothing :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v$1565" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1562" ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1565" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1562" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1565" ) ) ) + ( Ref Nothing ( Local ( Name "v$1562" ) ) ) ) ( Exception Nothing "No patterns matched" ) ) @@ -1249,34 +1243,34 @@ UberModule ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v$1517" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1514" ) :| [] ) ( DataArgumentByIndex Nothing ProductType 0 - ( Ref Nothing ( Local ( Name "v$1517" ) ) ) + ( Ref Nothing ( Local ( Name "v$1514" ) ) ) ) :| [] ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v$1518" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1515" ) :| [] ) ( DataArgumentByIndex Nothing ProductType 1 - ( Ref Nothing ( Local ( Name "v$1518" ) ) ) + ( Ref Nothing ( Local ( Name "v$1515" ) ) ) ) :| [] ) ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "s$11" ) :| [] ) + ( ParamNamed Nothing ( Name "s$8" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "v1$1568", AppN Nothing + ( Nothing, Name "v1$1565", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) ) - ( Ref Nothing ( Local ( Name "s$11" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "s$8" ) ) :| [] ) ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1568" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1565" ) ) ) ) ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) ) @@ -1290,14 +1284,14 @@ UberModule ) ( ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1568" ) ) ) + ( Ref Nothing ( Local ( Name "v1$1565" ) ) ) ) ( PropName "head" ) :| [] ) ) ( ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1568" ) ) ) + ( Ref Nothing ( Local ( Name "v1$1565" ) ) ) ) ( PropName "tail" ) :| [] ) :| [] @@ -1308,7 +1302,7 @@ UberModule ) :| [] ) ) - ( Ref Nothing ( Local ( Name "s$10" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "s$7" ) ) :| [] ) ) :| [] ) ) @@ -1410,62 +1404,6 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "" ) ( Ref Nothing ( Local ( Name "v1" ) ) ) ) ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) ) - ( IfThenElse Nothing - ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) ) ) - ( AppN Nothing - ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) ) - ( AppN Nothing - ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "unsafeCodePointAt0" ) - ) - ) - ( Ref Nothing ( Local ( Name "v1" ) ) :| [] ) :| [] - ) - ) - ( AppN Nothing - ( AppN Nothing - ( AppN Nothing - ( AppN Nothing - ( AppN Nothing - ( AppN Nothing - ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "_codePointAt" ) - ) - ) - ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "codePointAtFallback" ) - ) :| [] - ) - ) - ( Ref Nothing - ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) :| [] - ) - ) - ( Ref Nothing - ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) :| [] - ) - ) - ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "unsafeCodePointAt0" ) - ) :| [] - ) - ) - ( Ref Nothing ( Local ( Name "v" ) ) :| [] ) - ) - ( Ref Nothing ( Local ( Name "v1" ) ) :| [] ) - ) - ) - ) - ( IfThenElse Nothing - ( Eq Nothing ( LiteralInt Nothing 0 ) ( Ref Nothing ( Local ( Name "v" ) ) ) ) ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) ) ( AppN Nothing @@ -1478,44 +1416,42 @@ UberModule ( Ref Nothing ( Local ( Name "v1" ) ) :| [] ) :| [] ) ) + ) + ( AppN Nothing ( AppN Nothing ( AppN Nothing ( AppN Nothing ( AppN Nothing ( AppN Nothing - ( AppN Nothing - ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "_codePointAt" ) - ) - ) + ( ObjectProp Nothing ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "codePointAtFallback" ) - ) :| [] + ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "foreign" ) ) ) + ( PropName "_codePointAt" ) ) ( Ref Nothing - ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) :| [] + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "codePointAtFallback" ) + ) :| [] ) ) - ( Ref Nothing - ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) :| [] - ) + ( Ref Nothing ( Imported ( ModuleName "Data.Maybe" ) ( Name "Just" ) ) :| [] ) ) ( Ref Nothing - ( Imported - ( ModuleName "Data.String.CodePoints" ) - ( Name "unsafeCodePointAt0" ) - ) :| [] + ( Imported ( ModuleName "Data.Maybe" ) ( Name "Nothing" ) ) :| [] ) ) - ( Ref Nothing ( Local ( Name "v" ) ) :| [] ) + ( Ref Nothing + ( Imported + ( ModuleName "Data.String.CodePoints" ) + ( Name "unsafeCodePointAt0" ) + ) :| [] + ) ) - ( Ref Nothing ( Local ( Name "v1" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "v" ) ) :| [] ) ) + ( Ref Nothing ( Local ( Name "v1" ) ) :| [] ) ) ) ) @@ -1604,7 +1540,7 @@ UberModule ( LiteralObject Nothing [ ( PropName "succ", AbsN Nothing - ( ParamNamed Nothing ( Name "a$1553" ) :| [] ) + ( ParamNamed Nothing ( Name "a$1550" ) :| [] ) ( AppN Nothing ( ObjectProp Nothing ( Ref Nothing @@ -1626,14 +1562,14 @@ UberModule ) ( PropName "fromEnum" ) ) - ( Ref Nothing ( Local ( Name "a$1553" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "a$1550" ) ) :| [] ) ) ( LiteralInt Nothing 1 ) :| [] ) ) ), ( PropName "pred", AbsN Nothing - ( ParamNamed Nothing ( Name "a$1561" ) :| [] ) + ( ParamNamed Nothing ( Name "a$1558" ) :| [] ) ( AppN Nothing ( ObjectProp Nothing ( Ref Nothing @@ -1655,7 +1591,7 @@ UberModule ) ( PropName "fromEnum" ) ) - ( Ref Nothing ( Local ( Name "a$1561" ) ) :| [] ) + ( Ref Nothing ( Local ( Name "a$1558" ) ) :| [] ) ) ( LiteralInt Nothing 1 ) :| [] ) @@ -1712,21 +1648,21 @@ UberModule ( QName { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "cp" }, AbsN Nothing - ( ParamNamed Nothing ( Name "x$1653" ) :| [] ) + ( ParamNamed Nothing ( Name "x$1650" ) :| [] ) ( AppN Nothing ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Partial.Unsafe" ) ( Name "_unsafePartial" ) ) ) ( AbsN Nothing ( ParamUnused Nothing :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v$1527" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1524" ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1527" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v$1524" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1527" ) ) ) + ( Ref Nothing ( Local ( Name "v$1524" ) ) ) ) ( Exception Nothing "No patterns matched" ) ) @@ -1740,14 +1676,14 @@ UberModule ) ( PropName "toEnum" ) ) - ( Ref Nothing ( Local ( Name "x$1653" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "x$1650" ) ) :| [] ) :| [] ) ) ), Standalone ( QName { qnameModuleName = ModuleName "Golden.StringCodePoints.Test", qnameName = Name "codes" }, AbsN Nothing - ( ParamNamed Nothing ( Name "x$1650" ) :| [] ) + ( ParamNamed Nothing ( Name "x$1647" ) :| [] ) ( AppN Nothing ( AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.Functor" ) ( Name "arrayMap" ) ) ) @@ -1759,7 +1695,7 @@ UberModule ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "toCodePointArray" ) ) ) - ( Ref Nothing ( Local ( Name "x$1650" ) ) :| [] ) :| [] + ( Ref Nothing ( Local ( Name "x$1647" ) ) :| [] ) :| [] ) ) ) @@ -1773,20 +1709,20 @@ UberModule ( ParamUnused Nothing :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "$cse1763", LiteralObject Nothing + ( Nothing, Name "$cse1760", LiteralObject Nothing [ ( PropName "show", AbsN Nothing - ( ParamNamed Nothing ( Name "v$1706" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1703" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "$cse1764", ReflectCtor Nothing - ( Ref Nothing ( Local ( Name "v$1706" ) ) ) + ( Nothing, Name "$cse1761", ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v$1703" ) ) ) ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( Ref Nothing ( Local ( Name "$cse1764" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1761" ) ) ) ) ( PrimBinOp Nothing PrimConcat ( LiteralString Nothing "(Just " ) @@ -1796,7 +1732,7 @@ UberModule ( Imported ( ModuleName "Data.Show" ) ( Name "showIntImpl" ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1706" ) ) ) :| [] + ( Ref Nothing ( Local ( Name "v$1703" ) ) ) :| [] ) ) ( LiteralString Nothing ")" ) @@ -1805,7 +1741,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( Ref Nothing ( Local ( Name "$cse1764" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1761" ) ) ) ) ( LiteralString Nothing "Nothing" ) ( Exception Nothing "No patterns matched" ) @@ -1986,10 +1922,10 @@ UberModule ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow$w" ) ) ) ( Ref Nothing - ( Local ( Name "$cse1763" ) ) :| + ( Local ( Name "$cse1760" ) ) :| [ Let Nothing ( Standalone - ( Nothing, Name "v1$1704", AppN Nothing + ( Nothing, Name "v1$1701", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) @@ -2002,7 +1938,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1704" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1701" ) ) ) ) ) ( AppN Nothing ( Ref Nothing @@ -2016,7 +1952,7 @@ UberModule ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1704" ) ) ) :| [] + ( Ref Nothing ( Local ( Name "v1$1701" ) ) ) :| [] ) :| [] ) ) @@ -2035,10 +1971,10 @@ UberModule ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow$w" ) ) ) ( Ref Nothing - ( Local ( Name "$cse1763" ) ) :| + ( Local ( Name "$cse1760" ) ) :| [ Let Nothing ( Standalone - ( Nothing, Name "v1$1712", AppN Nothing + ( Nothing, Name "v1$1709", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) @@ -2051,7 +1987,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1712" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1709" ) ) ) ) ) ( AppN Nothing ( Ref Nothing @@ -2065,7 +2001,7 @@ UberModule ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1712" ) ) ) :| [] + ( Ref Nothing ( Local ( Name "v1$1709" ) ) ) :| [] ) :| [] ) ) @@ -2084,10 +2020,10 @@ UberModule ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow$w" ) ) ) ( Ref Nothing - ( Local ( Name "$cse1763" ) ) :| + ( Local ( Name "$cse1760" ) ) :| [ Let Nothing ( Standalone - ( Nothing, Name "v1$1720", AppN Nothing + ( Nothing, Name "v1$1717", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) @@ -2100,7 +2036,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1720" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1717" ) ) ) ) ) ( AppN Nothing ( Ref Nothing @@ -2114,7 +2050,7 @@ UberModule ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1720" ) ) ) :| [] + ( Ref Nothing ( Local ( Name "v1$1717" ) ) ) :| [] ) :| [] ) ) @@ -2133,10 +2069,10 @@ UberModule ( Imported ( ModuleName "Effect.Console" ) ( Name "logShow$w" ) ) ) ( Ref Nothing - ( Local ( Name "$cse1763" ) ) :| + ( Local ( Name "$cse1760" ) ) :| [ Let Nothing ( Standalone - ( Nothing, Name "v1$1731", AppN Nothing + ( Nothing, Name "v1$1728", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) ) @@ -2146,7 +2082,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1731" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1728" ) ) ) ) ) ( AppN Nothing ( Ref Nothing @@ -2161,7 +2097,7 @@ UberModule ) ( ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1731" ) ) ) + ( Ref Nothing ( Local ( Name "v1$1728" ) ) ) ) ( PropName "head" ) :| [] ) :| [] @@ -2184,17 +2120,17 @@ UberModule ( LiteralObject Nothing [ ( PropName "show", AbsN Nothing - ( ParamNamed Nothing ( Name "v$1644" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1641" ) :| [] ) ( Let Nothing ( Standalone - ( Nothing, Name "$cse1765", ReflectCtor Nothing - ( Ref Nothing ( Local ( Name "v$1644" ) ) ) + ( Nothing, Name "$cse1762", ReflectCtor Nothing + ( Ref Nothing ( Local ( Name "v$1641" ) ) ) ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( Ref Nothing ( Local ( Name "$cse1765" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1762" ) ) ) ) ( PrimBinOp Nothing PrimConcat ( LiteralString Nothing "(Just " ) @@ -2215,7 +2151,7 @@ UberModule ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1644" ) ) ) :| [] + ( Ref Nothing ( Local ( Name "v$1641" ) ) ) :| [] ) ) ( LiteralString Nothing ")" ) @@ -2224,7 +2160,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Nothing" ) - ( Ref Nothing ( Local ( Name "$cse1765" ) ) ) + ( Ref Nothing ( Local ( Name "$cse1762" ) ) ) ) ( LiteralString Nothing "Nothing" ) ( Exception Nothing "No patterns matched" ) @@ -2235,7 +2171,7 @@ UberModule ] :| [ Let Nothing ( Standalone - ( Nothing, Name "v1$1746", AppN Nothing + ( Nothing, Name "v1$1743", AppN Nothing ( Ref Nothing ( Imported ( ModuleName "Data.String.CodePoints" ) ( Name "uncons" ) ) ) @@ -2245,7 +2181,7 @@ UberModule ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) - ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1746" ) ) ) ) + ( ReflectCtor Nothing ( Ref Nothing ( Local ( Name "v1$1743" ) ) ) ) ) ( AppN Nothing ( Ref Nothing @@ -2272,7 +2208,7 @@ UberModule ) ( ObjectProp Nothing ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v1$1746" ) ) ) + ( Ref Nothing ( Local ( Name "v1$1743" ) ) ) ) ( PropName "tail" ) :| [] ) :| [] @@ -2296,13 +2232,13 @@ UberModule ( LiteralObject Nothing [ ( PropName "show", AbsN Nothing - ( ParamNamed Nothing ( Name "v$1235" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1232" ) :| [] ) ( IfThenElse Nothing - ( Ref Nothing ( Local ( Name "v$1235" ) ) ) + ( Ref Nothing ( Local ( Name "v$1232" ) ) ) ( LiteralString Nothing "true" ) ( IfThenElse Nothing ( Eq Nothing ( LiteralBool Nothing False ) - ( Ref Nothing ( Local ( Name "v$1235" ) ) ) + ( Ref Nothing ( Local ( Name "v$1232" ) ) ) ) ( LiteralString Nothing "false" ) ( Exception Nothing "No patterns matched" ) @@ -2386,16 +2322,16 @@ UberModule ( AbsN Nothing ( ParamUnused Nothing :| [] ) ( AbsN Nothing - ( ParamNamed Nothing ( Name "v$1759" ) :| [] ) + ( ParamNamed Nothing ( Name "v$1756" ) :| [] ) ( IfThenElse Nothing ( Eq Nothing ( LiteralString Nothing "Data.Maybe∷Maybe.Just" ) ( ReflectCtor Nothing - ( Ref Nothing ( Local ( Name "v$1759" ) ) ) + ( Ref Nothing ( Local ( Name "v$1756" ) ) ) ) ) ( DataArgumentByIndex Nothing SumType 0 - ( Ref Nothing ( Local ( Name "v$1759" ) ) ) + ( Ref Nothing ( Local ( Name "v$1756" ) ) ) ) ( Exception Nothing "No patterns matched" ) ) diff --git a/test/ps/output/Golden.StringCodePoints.Test/golden.lua b/test/ps/output/Golden.StringCodePoints.Test/golden.lua index 24ce3064..7b6c0e64 100644 --- a/test/ps/output/Golden.StringCodePoints.Test/golden.lua +++ b/test/ps/output/Golden.StringCodePoints.Test/golden.lua @@ -258,7 +258,6 @@ local Data_String_CodePoints_foreign = (function() end } end)() -local Data_String_CodePoints__codePointAt = Data_String_CodePoints_foreign._codePointAt local Effect_Console_foreign = { log = function(s) return function() print(s) end end } @@ -271,17 +270,17 @@ Data_HeytingAlgebra_heytingAlgebraBoolean = { return Data_HeytingAlgebra_heytingAlgebraBoolean.disj(Data_HeytingAlgebra_heytingAlgebraBoolean._not_(a))(b) end end, - conj = function(b1_S_1497) - return function(b2_S_1498) return b1_S_1497 and b2_S_1498 end + conj = function(b1_S_1494) + return function(b2_S_1495) return b1_S_1494 and b2_S_1495 end end, - disj = function(b1_S_1495) - return function(b2_S_1496) return b1_S_1495 or b2_S_1496 end + disj = function(b1_S_1492) + return function(b2_S_1493) return b1_S_1492 or b2_S_1493 end end, - _not_ = function(b_S_1494) return not(b_S_1494) end + _not_ = function(b_S_1491) return not(b_S_1491) end } local Data_Eq_eqInt = { - eq = function(r1_S_1490) - return function(r2_S_1491) return r1_S_1490 == r2_S_1491 end + eq = function(r1_S_1487) + return function(r2_S_1488) return r1_S_1487 == r2_S_1488 end end } local Data_Show_showInt = { show = Data_Show_showIntImpl } @@ -289,11 +288,11 @@ local Data_Ordering_LT = { "Data.Ordering∷Ordering.LT" } local Data_Ordering_GT = { "Data.Ordering∷Ordering.GT" } local Data_Ordering_EQ = { "Data.Ordering∷Ordering.EQ" } local Data_Ord_ordInt = { - compare = function(x_S_1474) - return function(y_S_1475) - if x_S_1474 < y_S_1475 then + compare = function(x_S_1471) + return function(y_S_1472) + if x_S_1471 < y_S_1472 then return Data_Ordering_LT - elseif x_S_1474 == y_S_1475 then + elseif x_S_1471 == y_S_1472 then return Data_Ordering_EQ else return Data_Ordering_GT @@ -319,44 +318,44 @@ local Data_Enum_bottom1 = Data_Bounded_bottomChar local Data_Enum_top1 = Data_Bounded_topChar local Data_String_CodePoints_conj = Data_HeytingAlgebra_heytingAlgebraBoolean.conj local Data_String_CodePoints_fromEnum = Data_Enum_toCharCode -local Data_String_CodePoints_unsafeCodePointAt0 = Data_String_CodePoints_foreign._unsafeCodePointAt0(function( s_S_27 ) - local cu0_S_28 = Data_String_CodePoints_fromEnum(Data_String_Unsafe_charAt(0)(s_S_27)) - if Data_String_CodePoints_conj(Data_String_CodePoints_conj(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, 55296, cu0_S_28))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, cu0_S_28, 56319)))("Data.Ordering∷Ordering.GT" == ((function( ) - local x_S_1588 = Data_String_CodeUnits_length(s_S_27) - return function(y_S_1589) - if x_S_1588 < y_S_1589 then +local Data_String_CodePoints_unsafeCodePointAt0 = Data_String_CodePoints_foreign._unsafeCodePointAt0(function( s_S_24 ) + local cu0_S_25 = Data_String_CodePoints_fromEnum(Data_String_Unsafe_charAt(0)(s_S_24)) + if Data_String_CodePoints_conj(Data_String_CodePoints_conj(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, 55296, cu0_S_25))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, cu0_S_25, 56319)))("Data.Ordering∷Ordering.GT" == ((function( ) + local x_S_1585 = Data_String_CodeUnits_length(s_S_24) + return function(y_S_1586) + if x_S_1585 < y_S_1586 then return Data_Ordering_LT - elseif x_S_1588 == y_S_1589 then + elseif x_S_1585 == y_S_1586 then return Data_Ordering_EQ else return Data_Ordering_GT end end end)()(1))[1]) then - local cu1_S_30 = Data_String_CodePoints_fromEnum(Data_String_Unsafe_charAt(1)(s_S_27)) - if Data_String_CodePoints_conj(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, 56320, cu1_S_30))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, cu1_S_30, 57343)) then - return (cu0_S_28 - 55296) * 1024 + (cu1_S_30 - 56320) + 65536 + local cu1_S_27 = Data_String_CodePoints_fromEnum(Data_String_Unsafe_charAt(1)(s_S_24)) + if Data_String_CodePoints_conj(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, 56320, cu1_S_27))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, cu1_S_27, 57343)) then + return (cu0_S_25 - 55296) * 1024 + (cu1_S_27 - 56320) + 65536 else - return cu0_S_28 + return cu0_S_25 end else - return cu0_S_28 + return cu0_S_25 end end) local Data_String_CodePoints_singletonFallback = function(v) - local _S_cse1761 = Data_HeytingAlgebra_heytingAlgebraBoolean.conj + local _S_cse1758 = Data_HeytingAlgebra_heytingAlgebraBoolean.conj if Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, v, 65535) then return Data_String_CodeUnits_singleton((function() - local v_S_1749 = (function() - if _S_cse1761(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, v, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, v, Data_Enum_toCharCode(Data_Enum_top1))) then + local v_S_1746 = (function() + if _S_cse1758(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, v, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, v, Data_Enum_toCharCode(Data_Enum_top1))) then return Data_Maybe_Just(Data_Enum_fromCharCode(v)) else return Data_Maybe_Nothing end end)() - if "Data.Maybe∷Maybe.Just" == v_S_1749[1] then - return v_S_1749[2] - elseif "Data.Maybe∷Maybe.Nothing" == v_S_1749[1] then + if "Data.Maybe∷Maybe.Just" == v_S_1746[1] then + return v_S_1746[2] + elseif "Data.Maybe∷Maybe.Nothing" == v_S_1746[1] then if Data_Ord_lessThan_S_w(Data_Ord_ordInt, v, Data_Enum_toCharCode(Data_Bounded_bottomChar)) then return Data_Bounded_bottomChar else @@ -368,19 +367,19 @@ local Data_String_CodePoints_singletonFallback = function(v) end)()) else return (function() - local x_S_1750 = Data_EuclideanRing_foreign.intDiv(v - 65536)(1024) + 55296 + local x_S_1747 = Data_EuclideanRing_foreign.intDiv(v - 65536)(1024) + 55296 return Data_String_CodeUnits_singleton((function() - local v_S_1751 = (function() - if _S_cse1761(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, x_S_1750, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, x_S_1750, Data_Enum_toCharCode(Data_Enum_top1))) then - return Data_Maybe_Just(Data_Enum_fromCharCode(x_S_1750)) + local v_S_1748 = (function() + if _S_cse1758(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, x_S_1747, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, x_S_1747, Data_Enum_toCharCode(Data_Enum_top1))) then + return Data_Maybe_Just(Data_Enum_fromCharCode(x_S_1747)) else return Data_Maybe_Nothing end end)() - if "Data.Maybe∷Maybe.Just" == v_S_1751[1] then - return v_S_1751[2] - elseif "Data.Maybe∷Maybe.Nothing" == v_S_1751[1] then - if Data_Ord_lessThan_S_w(Data_Ord_ordInt, x_S_1750, Data_Enum_toCharCode(Data_Bounded_bottomChar)) then + if "Data.Maybe∷Maybe.Just" == v_S_1748[1] then + return v_S_1748[2] + elseif "Data.Maybe∷Maybe.Nothing" == v_S_1748[1] then + if Data_Ord_lessThan_S_w(Data_Ord_ordInt, x_S_1747, Data_Enum_toCharCode(Data_Bounded_bottomChar)) then return Data_Bounded_bottomChar else return Data_Bounded_topChar @@ -390,19 +389,19 @@ local Data_String_CodePoints_singletonFallback = function(v) end end)()) end)() .. (function() - local x_S_1752 = Data_EuclideanRing_foreign.intMod(v - 65536)(1024) + 56320 + local x_S_1749 = Data_EuclideanRing_foreign.intMod(v - 65536)(1024) + 56320 return Data_String_CodeUnits_singleton((function() - local v_S_1753 = (function() - if _S_cse1761(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, x_S_1752, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, x_S_1752, Data_Enum_toCharCode(Data_Enum_top1))) then - return Data_Maybe_Just(Data_Enum_fromCharCode(x_S_1752)) + local v_S_1750 = (function() + if _S_cse1758(Data_Ord_greaterThanOrEq_S_w(Data_Ord_ordInt, x_S_1749, Data_Enum_toCharCode(Data_Enum_bottom1)))(Data_Ord_lessThanOrEq_S_w(Data_Ord_ordInt, x_S_1749, Data_Enum_toCharCode(Data_Enum_top1))) then + return Data_Maybe_Just(Data_Enum_fromCharCode(x_S_1749)) else return Data_Maybe_Nothing end end)() - if "Data.Maybe∷Maybe.Just" == v_S_1753[1] then - return v_S_1753[2] - elseif "Data.Maybe∷Maybe.Nothing" == v_S_1753[1] then - if Data_Ord_lessThan_S_w(Data_Ord_ordInt, x_S_1752, Data_Enum_toCharCode(Data_Bounded_bottomChar)) then + if "Data.Maybe∷Maybe.Just" == v_S_1750[1] then + return v_S_1750[2] + elseif "Data.Maybe∷Maybe.Nothing" == v_S_1750[1] then + if Data_Ord_lessThan_S_w(Data_Ord_ordInt, x_S_1749, Data_Enum_toCharCode(Data_Bounded_bottomChar)) then return Data_Bounded_bottomChar else return Data_Bounded_topChar @@ -429,8 +428,8 @@ local Data_String_CodePoints_ordCodePoint = { end, Eq0 = function() return { - eq = function(x_S_20) - return function(y_S_21) return x_S_20 == y_S_21 end + eq = function(x_S_17) + return function(y_S_18) return x_S_17 == y_S_18 end end } end @@ -451,9 +450,9 @@ Data_String_CodePoints_takeFallback_S_w = function(v, v1) if Data_Ord_lessThan_S_w(Data_Ord_ordInt, v, 1) then return "" else - local v2_S_17 = Data_String_CodePoints_uncons(v1) - if "Data.Maybe∷Maybe.Just" == v2_S_17[1] then - return Data_String_CodePoints_singleton(v2_S_17[2].head) .. Data_String_CodePoints_takeFallback_S_w(v - 1, v2_S_17[2].tail) + local v2_S_14 = Data_String_CodePoints_uncons(v1) + if "Data.Maybe∷Maybe.Just" == v2_S_14[1] then + return Data_String_CodePoints_singleton(v2_S_14[2].head) .. Data_String_CodePoints_takeFallback_S_w(v - 1, v2_S_14[2].tail) else return v1 end @@ -470,36 +469,36 @@ end Data_String_CodePoints_drop_S_w = function(n, s) return Data_String_CodeUnits_foreign.drop(Data_String_CodeUnits_length(Data_String_CodePoints_take_S_w(n, s)))(s) end -local Data_String_CodePoints_toCodePointArray = Data_String_CodePoints_foreign._toCodePointArray(function( s_S_10 ) - return Data_Unfoldable_foreign.unfoldrArrayImpl(function(v2_S_1519) - local _S_cse1762 = v2_S_1519[1] - if "Data.Maybe∷Maybe.Nothing" == _S_cse1762 then +local Data_String_CodePoints_toCodePointArray = Data_String_CodePoints_foreign._toCodePointArray(function( s_S_7 ) + return Data_Unfoldable_foreign.unfoldrArrayImpl(function(v2_S_1516) + local _S_cse1759 = v2_S_1516[1] + if "Data.Maybe∷Maybe.Nothing" == _S_cse1759 then return true - elseif "Data.Maybe∷Maybe.Just" == _S_cse1762 then + elseif "Data.Maybe∷Maybe.Just" == _S_cse1759 then return false else return error("No patterns matched") end end)(Partial_Unsafe__unsafePartial(function() - return function(v_S_1565) - if "Data.Maybe∷Maybe.Just" == v_S_1565[1] then - return v_S_1565[2] + return function(v_S_1562) + if "Data.Maybe∷Maybe.Just" == v_S_1562[1] then + return v_S_1562[2] else return error("No patterns matched") end end - end))(function(v_S_1517) return v_S_1517[1] end)(function(v_S_1518) - return v_S_1518[2] - end)(function(s_S_11) - local v1_S_1568 = Data_String_CodePoints_uncons(s_S_11) - if "Data.Maybe∷Maybe.Just" == v1_S_1568[1] then + end))(function(v_S_1514) return v_S_1514[1] end)(function(v_S_1515) + return v_S_1515[2] + end)(function(s_S_8) + local v1_S_1565 = Data_String_CodePoints_uncons(s_S_8) + if "Data.Maybe∷Maybe.Just" == v1_S_1565[1] then return Data_Maybe_Just((function(value0) return function(value1) return { value0, value1 } end - end)(v1_S_1568[2].head)(v1_S_1568[2].tail)) + end)(v1_S_1565[2].head)(v1_S_1565[2].tail)) else return Data_Maybe_Nothing end - end)(s_S_10) + end)(s_S_7) end)(Data_String_CodePoints_unsafeCodePointAt0) local Data_String_CodePoints_codePointAtFallback_S_w = function(n, s) while true do @@ -526,15 +525,11 @@ local Data_String_CodePoints_codePointAt_S_w = function(v, v1) elseif 0 == v then if "" == v1 then return Data_Maybe_Nothing - elseif 0 == v then - return Data_Maybe_Just(Data_String_CodePoints_unsafeCodePointAt0(v1)) else - return Data_String_CodePoints__codePointAt(Data_String_CodePoints_codePointAtFallback)(Data_Maybe_Just)(Data_Maybe_Nothing)(Data_String_CodePoints_unsafeCodePointAt0)(v)(v1) + return Data_Maybe_Just(Data_String_CodePoints_unsafeCodePointAt0(v1)) end - elseif 0 == v then - return Data_Maybe_Just(Data_String_CodePoints_unsafeCodePointAt0(v1)) else - return Data_String_CodePoints__codePointAt(Data_String_CodePoints_codePointAtFallback)(Data_Maybe_Just)(Data_Maybe_Nothing)(Data_String_CodePoints_unsafeCodePointAt0)(v)(v1) + return Data_String_CodePoints_foreign._codePointAt(Data_String_CodePoints_codePointAtFallback)(Data_Maybe_Just)(Data_Maybe_Nothing)(Data_String_CodePoints_unsafeCodePointAt0)(v)(v1) end end local Data_String_CodePoints_Lazy_enumCodePoint @@ -559,11 +554,11 @@ local Data_String_CodePoints_boundedEnumCodePoint = { } Data_String_CodePoints_Lazy_enumCodePoint = PSLUA_runtime_lazy("enumCodePoint")(function( ) return { - succ = function(a_S_1553) - return Data_String_CodePoints_boundedEnumCodePoint.toEnum(Data_String_CodePoints_boundedEnumCodePoint.fromEnum(a_S_1553) + 1) + succ = function(a_S_1550) + return Data_String_CodePoints_boundedEnumCodePoint.toEnum(Data_String_CodePoints_boundedEnumCodePoint.fromEnum(a_S_1550) + 1) end, - pred = function(a_S_1561) - return Data_String_CodePoints_boundedEnumCodePoint.toEnum(Data_String_CodePoints_boundedEnumCodePoint.fromEnum(a_S_1561) - 1) + pred = function(a_S_1558) + return Data_String_CodePoints_boundedEnumCodePoint.toEnum(Data_String_CodePoints_boundedEnumCodePoint.fromEnum(a_S_1558) - 1) end, Ord0 = function() return Data_String_CodePoints_ordCodePoint end } @@ -575,27 +570,27 @@ local Golden_StringCodePoints_Test_fromEnum = Data_String_CodePoints_boundedEnum local Golden_StringCodePoints_Test_showArray = { show = Data_Show_showArrayImpl(Data_Show_showIntImpl) } -M.Golden_StringCodePoints_Test_cp = function(x_S_1653) +M.Golden_StringCodePoints_Test_cp = function(x_S_1650) return Partial_Unsafe__unsafePartial(function() - return function(v_S_1527) - if "Data.Maybe∷Maybe.Just" == v_S_1527[1] then - return v_S_1527[2] + return function(v_S_1524) + if "Data.Maybe∷Maybe.Just" == v_S_1524[1] then + return v_S_1524[2] else return error("No patterns matched") end end - end)(Data_String_CodePoints_boundedEnumCodePoint.toEnum(x_S_1653)) + end)(Data_String_CodePoints_boundedEnumCodePoint.toEnum(x_S_1650)) end -M.Golden_StringCodePoints_Test_codes = function(x_S_1650) - return Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(x_S_1650)) +M.Golden_StringCodePoints_Test_codes = function(x_S_1647) + return Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(x_S_1647)) end return (function() - local _S_cse1763 = { - show = function(v_S_1706) - local _S_cse1764 = v_S_1706[1] - if "Data.Maybe∷Maybe.Just" == _S_cse1764 then - return "(Just " .. Data_Show_showIntImpl(v_S_1706[2]) .. ")" - elseif "Data.Maybe∷Maybe.Nothing" == _S_cse1764 then + local _S_cse1760 = { + show = function(v_S_1703) + local _S_cse1761 = v_S_1703[1] + if "Data.Maybe∷Maybe.Just" == _S_cse1761 then + return "(Just " .. Data_Show_showIntImpl(v_S_1703[2]) .. ")" + elseif "Data.Maybe∷Maybe.Nothing" == _S_cse1761 then return "Nothing" else return error("No patterns matched") @@ -607,62 +602,62 @@ return (function() local _ = Effect_Console_logShow_S_w(Data_Show_showInt, Data_String_CodeUnits_length("aéЯ𝐀z"))() local _ = Effect_Console_logShow_S_w(Golden_StringCodePoints_Test_showArray, Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(Data_String_CodePoints_take_S_w(2, "aéЯ𝐀z"))))() local _ = Effect_Console_logShow_S_w(Golden_StringCodePoints_Test_showArray, Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(Data_String_CodePoints_drop_S_w(2, "aéЯ𝐀z"))))() - local _ = Effect_Console_logShow_S_w(_S_cse1763, (function() - local v1_S_1704 = Data_String_CodePoints_codePointAt_S_w(0, "aéЯ𝐀z") - if "Data.Maybe∷Maybe.Just" == v1_S_1704[1] then - return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1704[2])) + local _ = Effect_Console_logShow_S_w(_S_cse1760, (function() + local v1_S_1701 = Data_String_CodePoints_codePointAt_S_w(0, "aéЯ𝐀z") + if "Data.Maybe∷Maybe.Just" == v1_S_1701[1] then + return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1701[2])) else return Data_Maybe_Nothing end end)())() - local _ = Effect_Console_logShow_S_w(_S_cse1763, (function() - local v1_S_1712 = Data_String_CodePoints_codePointAt_S_w(3, "aéЯ𝐀z") - if "Data.Maybe∷Maybe.Just" == v1_S_1712[1] then - return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1712[2])) + local _ = Effect_Console_logShow_S_w(_S_cse1760, (function() + local v1_S_1709 = Data_String_CodePoints_codePointAt_S_w(3, "aéЯ𝐀z") + if "Data.Maybe∷Maybe.Just" == v1_S_1709[1] then + return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1709[2])) else return Data_Maybe_Nothing end end)())() - local _ = Effect_Console_logShow_S_w(_S_cse1763, (function() - local v1_S_1720 = Data_String_CodePoints_codePointAt_S_w(5, "aéЯ𝐀z") - if "Data.Maybe∷Maybe.Just" == v1_S_1720[1] then - return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1720[2])) + local _ = Effect_Console_logShow_S_w(_S_cse1760, (function() + local v1_S_1717 = Data_String_CodePoints_codePointAt_S_w(5, "aéЯ𝐀z") + if "Data.Maybe∷Maybe.Just" == v1_S_1717[1] then + return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1717[2])) else return Data_Maybe_Nothing end end)())() - local _ = Effect_Console_logShow_S_w(_S_cse1763, (function() - local v1_S_1731 = Data_String_CodePoints_uncons("aéЯ𝐀z") - if "Data.Maybe∷Maybe.Just" == v1_S_1731[1] then - return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1731[2].head)) + local _ = Effect_Console_logShow_S_w(_S_cse1760, (function() + local v1_S_1728 = Data_String_CodePoints_uncons("aéЯ𝐀z") + if "Data.Maybe∷Maybe.Just" == v1_S_1728[1] then + return Data_Maybe_Just(Golden_StringCodePoints_Test_fromEnum(v1_S_1728[2].head)) else return Data_Maybe_Nothing end end)())() local _ = Effect_Console_logShow_S_w({ - show = function(v_S_1644) - local _S_cse1765 = v_S_1644[1] - if "Data.Maybe∷Maybe.Just" == _S_cse1765 then - return "(Just " .. Data_Show_showArrayImpl(Data_Show_showIntImpl)(v_S_1644[2]) .. ")" - elseif "Data.Maybe∷Maybe.Nothing" == _S_cse1765 then + show = function(v_S_1641) + local _S_cse1762 = v_S_1641[1] + if "Data.Maybe∷Maybe.Just" == _S_cse1762 then + return "(Just " .. Data_Show_showArrayImpl(Data_Show_showIntImpl)(v_S_1641[2]) .. ")" + elseif "Data.Maybe∷Maybe.Nothing" == _S_cse1762 then return "Nothing" else return error("No patterns matched") end end }, (function() - local v1_S_1746 = Data_String_CodePoints_uncons("aéЯ𝐀z") - if "Data.Maybe∷Maybe.Just" == v1_S_1746[1] then - return Data_Maybe_Just(Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(v1_S_1746[2].tail))) + local v1_S_1743 = Data_String_CodePoints_uncons("aéЯ𝐀z") + if "Data.Maybe∷Maybe.Just" == v1_S_1743[1] then + return Data_Maybe_Just(Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(v1_S_1743[2].tail))) else return Data_Maybe_Nothing end end)())() local _ = Effect_Console_logShow_S_w({ - show = function(v_S_1235) - if v_S_1235 then + show = function(v_S_1232) + if v_S_1232 then return "true" - elseif false == v_S_1235 then + elseif false == v_S_1232 then return "false" else return error("No patterns matched") @@ -670,9 +665,9 @@ return (function() end }, Data_String_CodePoints_foreign._fromCodePointArray(Data_String_CodePoints_singletonFallback)(Data_String_CodePoints_toCodePointArray("aéЯ𝐀z")) == "aéЯ𝐀z")() return Effect_Console_logShow_S_w(Golden_StringCodePoints_Test_showArray, Data_Functor_arrayMap(Golden_StringCodePoints_Test_fromEnum)(Data_String_CodePoints_toCodePointArray(Data_String_CodePoints_singleton(Partial_Unsafe__unsafePartial(function( ) - return function(v_S_1759) - if "Data.Maybe∷Maybe.Just" == v_S_1759[1] then - return v_S_1759[2] + return function(v_S_1756) + if "Data.Maybe∷Maybe.Just" == v_S_1756[1] then + return v_S_1756[2] else return error("No patterns matched") end diff --git a/test/ps/src/Golden/CasePruning/Test.purs b/test/ps/src/Golden/CasePruning/Test.purs new file mode 100644 index 00000000..6e0b2496 --- /dev/null +++ b/test/ps/src/Golden/CasePruning/Test.purs @@ -0,0 +1,52 @@ +-- @inline export literalRetest never +-- @inline export ctorRetest never +-- @inline export literalNegatives never +module Golden.CasePruning.Test where + +import Prelude + +import Effect (Effect) +import Effect.Console (logShow) + +-- The Data.String.CodePoints.codePointAt shape: clause 2 fails on its +-- second pattern, clause 3 re-tests 0 == n although the answer is +-- already decided on both paths. +literalRetest :: Int -> String -> Int +literalRetest 0 "" = 1 +literalRetest 0 _ = 2 +literalRetest _ _ = 3 + +data T = A | B | C + +-- On the path where both A and B failed on the first scrutinee, +-- clause 3 re-tests A: negative knowledge must accumulate across +-- failed tags for the retest to be pruned. +ctorRetest :: T -> T -> Int +ctorRetest A A = 1 +ctorRetest B B = 2 +ctorRetest A B = 3 +ctorRetest _ _ = 4 + +-- The literal twin of ctorRetest: a positive 1 == n excludes 2 == n, +-- and two accumulated negatives decide the retest of 1 == n. +literalNegatives :: Int -> Int -> Int +literalNegatives 1 1 = 1 +literalNegatives 2 2 = 2 +literalNegatives 1 2 = 3 +literalNegatives _ _ = 4 + +main :: Effect Unit +main = do + logShow (literalRetest 0 "") + logShow (literalRetest 0 "x") + logShow (literalRetest 5 "") + logShow (ctorRetest A A) + logShow (ctorRetest B B) + logShow (ctorRetest A B) + logShow (ctorRetest A C) + logShow (ctorRetest C C) + logShow (literalNegatives 1 1) + logShow (literalNegatives 2 2) + logShow (literalNegatives 1 2) + logShow (literalNegatives 1 3) + logShow (literalNegatives 3 3)