X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=sem.icl;h=0ffcdd282015af67631b0cd926d3042b01650379;hb=24472f94b2af1d2c01db24c4ddfe61143dda1459;hp=833d543039e2890b2f806e194401e61f7cf4cd49;hpb=d509f40d8fdf986a852b80326dd157f0b68117d1;p=cc1516.git 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