X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=sem.icl;h=0c5b55273cb8d7fb05f1fe73dc1fa069409ff49c;hb=978dc486bf8c83cf9cad0925e3128574639656e0;hp=833d543039e2890b2f806e194401e61f7cf4cd49;hpb=f8726ca2b0b6d1de65e08dc2d68bc6128753c49c;p=cc1516.git diff --git a/sem.icl b/sem.icl index 833d543..0c5b552 100644 --- a/sem.icl +++ b/sem.icl @@ -50,8 +50,8 @@ 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 "read" (Forall [] (IntType ->> (ListType CharType))) + $ extend "isEmpty" (Forall ["a"] ((ListType (IdType "a")) ->> BoolType)) + $ extend "read" (Forall [] CharType) zero sem :: AST -> Either [SemError] AST @@ -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