From 901b09dada43ec6f3b21618800ec7400fda54a0d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 18 Oct 2017 12:42:46 -0400 Subject: - Updated to the latest changes in stdlib. --- new-luxc/source/luxc/analyser/case/coverage.lux | 40 ++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'new-luxc/source/luxc/analyser/case') diff --git a/new-luxc/source/luxc/analyser/case/coverage.lux b/new-luxc/source/luxc/analyser/case/coverage.lux index 94aa06e9b..cb066a2bf 100644 --- a/new-luxc/source/luxc/analyser/case/coverage.lux +++ b/new-luxc/source/luxc/analyser/case/coverage.lux @@ -4,7 +4,7 @@ eq) (data [bool "B/" Eq] [number] - ["R" result "R/" Monad] + ["e" error "error/" Monad] (coll [list "L/" Fold] ["D" dict]))) (luxc (lang ["la" analysis]))) @@ -97,8 +97,8 @@ ## Because of that, the presence of redundant patterns is assumed to ## be a bug, likely due to programmer carelessness. (def: redundant-pattern - (R;Result Coverage) - (R;fail "Redundant pattern.")) + (e;Error Coverage) + (e;fail "Redundant pattern.")) (def: (flatten-alt coverage) (-> Coverage (List Coverage)) @@ -144,7 +144,7 @@ ## pattern-matching expression is exhaustive and whether it contains ## redundant patterns. (def: #export (merge addition so-far) - (-> Coverage Coverage (R;Result Coverage)) + (-> Coverage Coverage (e;Error Coverage)) (case [addition so-far] ## The addition cannot possibly improve the coverage. [_ #Exhaustive] @@ -152,25 +152,25 @@ ## The addition completes the coverage. [#Exhaustive _] - (R/wrap #Exhaustive) + (error/wrap #Exhaustive) [#Partial #Partial] - (R/wrap #Partial) + (error/wrap #Partial) ## 2 boolean coverages are exhaustive if they compliment one another. (^multi [(#Bool sideA) (#Bool sideSF)] (xor sideA sideSF)) - (R/wrap #Exhaustive) + (error/wrap #Exhaustive) [(#Variant allA casesA) (#Variant allSF casesSF)] (cond (not (n.= allSF allA)) - (R;fail "Variants do not match.") + (e;fail "Variants do not match.") (:: (D;Eq Eq) = casesSF casesA) redundant-pattern ## else - (do R;Monad + (do e;Monad [casesM (monad;fold @ (function [[tagA coverageA] casesSF'] (case (D;get tagA casesSF') @@ -196,11 +196,11 @@ ## The 2 sequences cannot possibly be merged. [false false] - (R/wrap (#Alt so-far addition)) + (error/wrap (#Alt so-far addition)) ## Same prefix [true false] - (do R;Monad + (do e;Monad [rightM (merge rightA rightSF)] (if (exhaustive? rightM) ## If all that follows is exhaustive, then it can be safely dropped @@ -211,7 +211,7 @@ ## Same suffix [false true] - (do R;Monad + (do e;Monad [leftM (merge leftA leftSF)] (wrap (#Seq leftM rightA)))) @@ -223,7 +223,7 @@ ## The right part is not necessary, since it can always match the left. (^multi [single (#Seq left right)] (C/= left single)) - (R/wrap single) + (error/wrap single) ## When merging a new coverage against one based on Alt, it may be ## that one of the many coverages in the Alt is complementary to @@ -235,10 +235,10 @@ ## This process must be repeated until no further productive ## merges can be done. [_ (#Alt leftS rightS)] - (do R;Monad + (do e;Monad [#let [fuse-once (: (-> Coverage (List Coverage) - (R;Result [(Maybe Coverage) - (List Coverage)])) + (e;Error [(Maybe Coverage) + (List Coverage)])) (function [coverage possibilities] (loop [alts possibilities] (case alts @@ -247,7 +247,7 @@ (#;Cons alt alts') (case (merge coverage alt) - (#R;Success altM) + (#e;Success altM) (case altM (#Alt _) (do @ @@ -257,8 +257,8 @@ _ (wrap [(#;Some altM) alts'])) - (#R;Error error) - (R;fail error)) + (#e;Error error) + (e;fail error)) ))))] [success possibilities] (fuse-once addition (flatten-alt so-far))] (loop [success success @@ -284,4 +284,4 @@ ## The addition cannot possibly improve the coverage. redundant-pattern ## There are now 2 alternative paths. - (R/wrap (#Alt so-far addition))))) + (error/wrap (#Alt so-far addition))))) -- cgit v1.2.3