summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2015-12-18 22:09:08 +0100
committerPéter Diviánszky <divipp@gmail.com>2015-12-18 22:09:08 +0100
commitb786d3c6608836d028696f74bf79dc7e960b3ca7 (patch)
treec7144133bf82cd5ecbb868e58f0900ebd531c9b9 /prototypes
parent60053b89d8e9205ab60249d97d60f8d72b0d67d7 (diff)
primIfThenElse is not builtin
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/Infer.hs6
-rw-r--r--prototypes/tests/accept/Builtins.lc4
2 files changed, 4 insertions, 6 deletions
diff --git a/prototypes/Infer.hs b/prototypes/Infer.hs
index 56e8c39c..8490761a 100644
--- a/prototypes/Infer.hs
+++ b/prototypes/Infer.hs
@@ -512,8 +512,6 @@ eval te = \case
512 T2 a b -> t2 a b 512 T2 a b -> t2 a b
513 FunN "T2C" [a, b] -> t2C a b 513 FunN "T2C" [a, b] -> t2C a b
514 514
515 FunN "PrimIfThenElse" [_, ConN "True" [], xt, xf] -> xt
516 FunN "PrimIfThenElse" [_, ConN "False" [], xt, xf] -> xf
517 FunN "primAdd" [EInt i, EInt j] -> EInt (i + j) 515 FunN "primAdd" [EInt i, EInt j] -> EInt (i + j)
518 FunN "primSub" [EInt i, EInt j] -> EInt (i - j) 516 FunN "primSub" [EInt i, EInt j] -> EInt (i - j)
519 FunN "primMod" [EInt i, EInt j] -> EInt (i `mod` j) 517 FunN "primMod" [EInt i, EInt j] -> EInt (i `mod` j)
@@ -1687,7 +1685,7 @@ mkRecord xs = SGlobal "RecordCons" `SAppH` names `SAppV` values
1687 1685
1688sVar e x = maybe (SGlobal x) SVar $ elemIndex' x e 1686sVar e x = maybe (SGlobal x) SVar $ elemIndex' x e
1689 1687
1690mkIf b t f = SGlobal "PrimIfThenElse" `SAppV` b `SAppV` t `SAppV` f 1688mkIf b t f = SGlobal "primIfThenElse" `SAppV` b `SAppV` t `SAppV` f
1691 1689
1692mkDotDot e f = SGlobal "fromTo" `SAppV` e `SAppV` f 1690mkDotDot e f = SGlobal "fromTo" `SAppV` e `SAppV` f
1693 1691
@@ -1753,7 +1751,7 @@ letdecl ns dbs = ask >>= \ge -> keyword "let" *> ((\((dbs', p), e) -> ({-join tr
1753 1751
1754boolExpression ns dbs = do 1752boolExpression ns dbs = do
1755 pred <- parseTerm ns PrecLam dbs 1753 pred <- parseTerm ns PrecLam dbs
1756 return (dbs, \e -> application [SGlobal "PrimIfThenElse", pred, e, SGlobal "Nil"]) 1754 return (dbs, \e -> application [SGlobal "primIfThenElse", pred, e, SGlobal "Nil"])
1757 1755
1758application = foldl1 SAppV 1756application = foldl1 SAppV
1759 1757
diff --git a/prototypes/tests/accept/Builtins.lc b/prototypes/tests/accept/Builtins.lc
index e805cc1c..048ee315 100644
--- a/prototypes/tests/accept/Builtins.lc
+++ b/prototypes/tests/accept/Builtins.lc
@@ -23,8 +23,8 @@ data Bool = False | True
23 23
24data Ordering = LT | EQ | GT 24data Ordering = LT | EQ | GT
25 25
26builtins 26primIfThenElse :: Bool -> a -> a -> a
27 PrimIfThenElse :: Bool -> a -> a -> a 27primIfThenElse b x y = boolCase (\_ -> _) y x b
28 28
29--------------------------------------- 29---------------------------------------
30 30