summaryrefslogtreecommitdiff
path: root/src/Parser/Core.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-04-19 10:41:11 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-04-19 11:04:52 +0200
commitdb5d73811c42d640f606ede40f861e1c052f8ca5 (patch)
tree8f15fa9c272df2872db98fbf9db1ffd3022d33b1 /src/Parser/Core.hs
parentc824435064ea288a758687d00777804f0a2d5af3 (diff)
Type application in expressions
Diffstat (limited to 'src/Parser/Core.hs')
-rw-r--r--src/Parser/Core.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs
index 1b049c8..c317067 100644
--- a/src/Parser/Core.hs
+++ b/src/Parser/Core.hs
@@ -207,6 +207,14 @@ unifyExpr off pa expr = if
-> return expr
| DynVariable stype sline name <- expr
+ , ExprTypeForall qvar itype <- stype
+ -> do
+ tvar <- newTypeVar
+ _ <- unify off (ExprTypePrim (Proxy :: Proxy a)) $ renameVarInType qvar tvar itype
+ rtype <- M.lookup tvar <$> gets testTypeUnif
+ return $ TypeApp (Variable sline name) $ fromMaybe (ExprTypeVar tvar) rtype
+
+ | DynVariable stype sline name <- expr
-> do
_ <- unify off (ExprTypePrim (Proxy :: Proxy a)) stype
return $ Variable sline name
@@ -215,12 +223,7 @@ unifyExpr off pa expr = if
-> do
unifyExpr off pa expr'
- | TypeQuant qvar expr' <- expr
- -> do
- tvar <- newTypeVar
- unifyExpr off pa $ renameTypeVar qvar tvar expr'
-
- | TypeLambda t tvar f <- expr
+ | TypeLambda tvar t f <- expr
-> do
_ <- unify off (ExprTypePrim (Proxy :: Proxy a)) t
Just (ExprTypePrim pt) <- M.lookup tvar <$> gets testTypeUnif