From 0567e0e242028586a71edb38d3fcac5b35df707f Mon Sep 17 00:00:00 2001 From: pimjager Date: Fri, 20 May 2016 13:35:39 +0200 Subject: [PATCH] Woooo isEmpty --- examples/codeGen.spl | 2 ++ sem.icl | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/codeGen.spl b/examples/codeGen.spl index 4062fb6..e5d938b 100644 --- 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) : []; + var sdaf = isE(x1); + var z = isEmpty(x1); x.hd.snd = 8; return; } diff --git a/sem.icl b/sem.icl index 833d543..0ffcdd2 100644 --- 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)) - $ extend "isEmpty" (Forall ["a"] (ListType (IdType "a") ->> BoolType)) + $ extend "isEmpty" (Forall ["a"] ((ListType (IdType "a")) ->> BoolType)) $ 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 -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 -- 2.20.1