From 12bca1c32d6655ed612938bfd4031ea488cef7e3 Mon Sep 17 00:00:00 2001 From: sebastianselander Date: Wed, 5 Apr 2023 12:56:57 +0200 Subject: [PATCH] Added small comment about incorrect subtyping --- src/TypeChecker/TypeCheckerHm.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/TypeChecker/TypeCheckerHm.hs b/src/TypeChecker/TypeCheckerHm.hs index 1b6ae4d..38582e5 100644 --- a/src/TypeChecker/TypeCheckerHm.hs +++ b/src/TypeChecker/TypeCheckerHm.hs @@ -595,6 +595,19 @@ fresh = do modify (\st -> st{count = succ (count st)}) return $ TVar $ MkTVar $ LIdent $ show n +{- + +The following definition of id should type check +id : forall a. a -> a +id x = (x : a) + +but not this one, according to haskell atleast + +id : a -> a +id x = (x : a) + +currently this is not the case, the TAll pattern match is incorrectly implemented. +-} -- Is the left a subtype of the right (<<=) :: Type -> Type -> Bool (<<=) (TVar _) _ = True