Added small comment about incorrect subtyping
This commit is contained in:
parent
c6e0e40ef1
commit
12bca1c32d
1 changed files with 13 additions and 0 deletions
|
|
@ -595,6 +595,19 @@ fresh = do
|
||||||
modify (\st -> st{count = succ (count st)})
|
modify (\st -> st{count = succ (count st)})
|
||||||
return $ TVar $ MkTVar $ LIdent $ show n
|
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
|
-- Is the left a subtype of the right
|
||||||
(<<=) :: Type -> Type -> Bool
|
(<<=) :: Type -> Type -> Bool
|
||||||
(<<=) (TVar _) _ = True
|
(<<=) (TVar _) _ = True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue