diff options
author | Eduardo Julian | 2017-09-05 18:36:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-09-05 18:36:09 -0400 |
commit | 50cc5fbe7cc8abde05085944393fcec4c791402f (patch) | |
tree | da706b648b3bb5e0485475a81d5b4da242aa04f5 /new-luxc/source/luxc/analyser/case | |
parent | 3add4d6996591897020236b5581f6ca21d4c2af8 (diff) |
- Updated new compiler's code to the recent changes in the language.
- WIP: Some other changes/additions to the new compiler.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/analyser/case.lux | 20 | ||||
-rw-r--r-- | new-luxc/source/luxc/analyser/case/coverage.lux | 26 |
2 files changed, 23 insertions, 23 deletions
diff --git a/new-luxc/source/luxc/analyser/case.lux b/new-luxc/source/luxc/analyser/case.lux index 30d0a2b7a..0f5b4da4e 100644 --- a/new-luxc/source/luxc/analyser/case.lux +++ b/new-luxc/source/luxc/analyser/case.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monad + (lux (control [monad #+ do] eq) (data [bool "B/" Eq<Bool>] [number] @@ -102,7 +102,7 @@ [Nat #;Nat #la;NatP] [Int #;Int #la;IntP] [Deg #;Deg #la;DegP] - [Real #;Real #la;RealP] + [Frac #;Frac #la;FracP] [Text #;Text #la;TextP]) (^ [cursor (#;Tuple (list))]) @@ -225,14 +225,14 @@ [[inputT inputA] (&common;with-unknown-type (analyse input)) outputH (analyse-pattern #;None inputT patternH (analyse bodyH)) - outputT (mapM @ - (function [[patternT bodyT]] - (analyse-pattern #;None inputT patternT (analyse bodyT))) - branchesT) - _ (case (foldM R;Monad<Result> - &&coverage;merge - (|> outputH product;left &&coverage;determine) - (L/map (|>. product;left &&coverage;determine) outputT)) + outputT (monad;map @ + (function [[patternT bodyT]] + (analyse-pattern #;None inputT patternT (analyse bodyT))) + branchesT) + _ (case (monad;fold R;Monad<Result> + &&coverage;merge + (|> outputH product;left &&coverage;determine) + (L/map (|>. product;left &&coverage;determine) outputT)) (#R;Success coverage) (if (&&coverage;total? coverage) (wrap []) diff --git a/new-luxc/source/luxc/analyser/case/coverage.lux b/new-luxc/source/luxc/analyser/case/coverage.lux index 88e40ac0f..cb7341d7a 100644 --- a/new-luxc/source/luxc/analyser/case/coverage.lux +++ b/new-luxc/source/luxc/analyser/case/coverage.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monad + (lux (control [monad #+ do] eq) (data [bool "B/" Eq<Bool>] [number] @@ -54,7 +54,7 @@ ## Primitive patterns always have partial coverage because there ## are too many possibilities as far as values go. (^or (#la;NatP _) (#la;IntP _) (#la;DegP _) - (#la;RealP _) (#la;TextP _)) + (#la;FracP _) (#la;TextP _)) #Partial ## Bools are the exception, since there is only "true" and @@ -171,17 +171,17 @@ ## else (do R;Monad<Result> - [casesM (foldM @ - (function [[tagA coverageA] casesSF'] - (case (D;get tagA casesSF') - (#;Some coverageSF) - (do @ - [coverageM (merge coverageA coverageSF)] - (wrap (D;put tagA coverageM casesSF'))) - - #;None - (wrap (D;put tagA coverageA casesSF')))) - casesSF (D;entries casesA))] + [casesM (monad;fold @ + (function [[tagA coverageA] casesSF'] + (case (D;get tagA casesSF') + (#;Some coverageSF) + (do @ + [coverageM (merge coverageA coverageSF)] + (wrap (D;put tagA coverageM casesSF'))) + + #;None + (wrap (D;put tagA coverageA casesSF')))) + casesSF (D;entries casesA))] (wrap (if (let [case-coverages (D;values casesM)] (and (n.= allSF (list;size case-coverages)) (list;every? total? case-coverages))) |