From 0905fe68591a3dad83f87d5ac805b674c0b88c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Fri, 1 May 2026 20:25:20 +0200 Subject: Arbitrary type expression as function arguments --- src/Parser/Core.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Parser/Core.hs') diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs index e1a4035..c12afdd 100644 --- a/src/Parser/Core.hs +++ b/src/Parser/Core.hs @@ -273,6 +273,17 @@ unifySomeExpr off stype sexpr@(SomeExpr expr) _ <- unify off (ExprTypeVar tvar) (someExprType sexpr) return sexpr + | ExprTypeFunction args res <- stype + = case someExprType sexpr of + ExprTypeFunction args' res' -> do + _ <- unify off args args' + _ <- unify off res res' + return sexpr + _ -> do + _ <- unify off args (ExprTypeArguments mempty) + SomeExpr expr' <- unifySomeExpr off res sexpr + return $ SomeExpr $ FunctionAbstraction expr' + | otherwise = do parseError $ FancyError off $ S.singleton $ ErrorFail $ T.unpack $ -- cgit v1.2.3