diff options
author | Péter Diviánszky <divipp@gmail.com> | 2015-12-18 22:09:08 +0100 |
---|---|---|
committer | Péter Diviánszky <divipp@gmail.com> | 2015-12-18 22:09:08 +0100 |
commit | b786d3c6608836d028696f74bf79dc7e960b3ca7 (patch) | |
tree | c7144133bf82cd5ecbb868e58f0900ebd531c9b9 /prototypes | |
parent | 60053b89d8e9205ab60249d97d60f8d72b0d67d7 (diff) |
primIfThenElse is not builtin
Diffstat (limited to 'prototypes')
-rw-r--r-- | prototypes/Infer.hs | 6 | ||||
-rw-r--r-- | prototypes/tests/accept/Builtins.lc | 4 |
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 | ||
1688 | sVar e x = maybe (SGlobal x) SVar $ elemIndex' x e | 1686 | sVar e x = maybe (SGlobal x) SVar $ elemIndex' x e |
1689 | 1687 | ||
1690 | mkIf b t f = SGlobal "PrimIfThenElse" `SAppV` b `SAppV` t `SAppV` f | 1688 | mkIf b t f = SGlobal "primIfThenElse" `SAppV` b `SAppV` t `SAppV` f |
1691 | 1689 | ||
1692 | mkDotDot e f = SGlobal "fromTo" `SAppV` e `SAppV` f | 1690 | mkDotDot 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 | ||
1754 | boolExpression ns dbs = do | 1752 | boolExpression 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 | ||
1758 | application = foldl1 SAppV | 1756 | application = 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 | ||
24 | data Ordering = LT | EQ | GT | 24 | data Ordering = LT | EQ | GT |
25 | 25 | ||
26 | builtins | 26 | primIfThenElse :: Bool -> a -> a -> a |
27 | PrimIfThenElse :: Bool -> a -> a -> a | 27 | primIfThenElse b x y = boolCase (\_ -> _) y x b |
28 | 28 | ||
29 | --------------------------------------- | 29 | --------------------------------------- |
30 | 30 | ||