repositories
/
cc1516.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9b58e55
)
Woooo isEmpty
author
pimjager
<pim@pimjager.nl>
Fri, 20 May 2016 11:35:39 +0000
(13:35 +0200)
committer
pimjager
<pim@pimjager.nl>
Fri, 20 May 2016 11:35:39 +0000
(13:35 +0200)
examples/codeGen.spl
patch
|
blob
|
history
sem.icl
patch
|
blob
|
history
diff --git
a/examples/codeGen.spl
b/examples/codeGen.spl
index
4062fb6
..
e5d938b
100644
(file)
--- a/
examples/codeGen.spl
+++ b/
examples/codeGen.spl
@@
-36,6
+36,8
@@
main() {
(Bool, Int) z = (True, 2);
var y = z.fst;
var x = (True, 5) : (False,0) : [];
(Bool, Int) z = (True, 2);
var y = z.fst;
var x = (True, 5) : (False,0) : [];
+ var sdaf = isE(x1);
+ var z = isEmpty(x1);
x.hd.snd = 8;
return;
}
x.hd.snd = 8;
return;
}
diff --git
a/sem.icl
b/sem.icl
index
833d543
..
0ffcdd2
100644
(file)
--- a/
sem.icl
+++ b/
sem.icl
@@
-50,7
+50,7
@@
variableStream = map toString [1..]
defaultGamma :: Gamma //includes all default functions
defaultGamma = extend "print" (Forall ["a"] ((IdType "a") ->> VoidType))
defaultGamma :: Gamma //includes all default functions
defaultGamma = extend "print" (Forall ["a"] ((IdType "a") ->> VoidType))
- $ extend "isEmpty" (Forall ["a"] (
ListType (IdType "a"
) ->> BoolType))
+ $ extend "isEmpty" (Forall ["a"] (
(ListType (IdType "a")
) ->> BoolType))
$ extend "read" (Forall [] (IntType ->> (ListType CharType)))
zero
$ extend "read" (Forall [] (IntType ->> (ListType CharType)))
zero
@@
-178,7
+178,6
@@
generalize :: Type -> Typing Scheme
generalize t = gamma >>= \g-> pure $ Forall (difference (ftv t) (ftv g)) t
lookup :: String -> Typing Type
generalize t = gamma >>= \g-> pure $ Forall (difference (ftv t) (ftv g)) t
lookup :: String -> Typing Type
-lookup "isEmpty" = ListType <$> fresh
lookup k = gamma >>= \g-> case 'Map'.member k g of
False = liftT (Left $ UndeclaredVariableError zero k)
True = instantiate $ 'Map'.find k g
lookup k = gamma >>= \g-> case 'Map'.member k g of
False = liftT (Left $ UndeclaredVariableError zero k)
True = instantiate $ 'Map'.find k g