summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2015-12-04 15:45:16 +0100
committerPéter Diviánszky <divipp@gmail.com>2015-12-04 15:45:16 +0100
commitc65864593fa7ed2cb58dccd039b4049fccf1504c (patch)
tree6fd36f6b1863b97dd2e013643b376402f1295bd5 /prototypes
parentc8efb32306feaa708e88564fac6e5d6093c0de31 (diff)
finish guards support
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/Infer.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/prototypes/Infer.hs b/prototypes/Infer.hs
index 56dfca7d..5b594359 100644
--- a/prototypes/Infer.hs
+++ b/prototypes/Infer.hs
@@ -1731,7 +1731,9 @@ compilePatts :: [(Pat, Int)] -> Maybe SExp -> SExp -> GuardTree
1731compilePatts ps gu = cp [] ps 1731compilePatts ps gu = cp [] ps
1732 where 1732 where
1733 cp ps' [] e = case gu of 1733 cp ps' [] e = case gu of
1734 Nothing -> GuardLeaf $ preExp $ \x -> {-join traceShow $ -} rearrangeS (f $ reverse ps') $ removePreExpsE x e 1734 Nothing -> rhs
1735 Just ge -> GuardNode (rearrangeS (f $ reverse ps') ge) "True" [] rhs
1736 where rhs = GuardLeaf $ preExp $ \x -> rearrangeS (f $ reverse ps') $ removePreExpsE x e
1735 cp ps' ((p@PVar, i): xs) e = cp (p: ps') xs e 1737 cp ps' ((p@PVar, i): xs) e = cp (p: ps') xs e
1736 cp ps' ((p@(PCon n ps), i): xs) e = GuardNode (SVar $ i + sum (map (fromMaybe 0 . ff) ps')) n ps $ cp (p: ps') xs e 1738 cp ps' ((p@(PCon n ps), i): xs) e = GuardNode (SVar $ i + sum (map (fromMaybe 0 . ff) ps')) n ps $ cp (p: ps') xs e
1737 cp ps' ((p@(ViewPat f (ParPat [PCon n ps])), i): xs) e 1739 cp ps' ((p@(ViewPat f (ParPat [PCon n ps])), i): xs) e