summaryrefslogtreecommitdiff
path: root/src/Parser/Expr.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-04-25 10:51:21 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-04-25 15:22:59 +0200
commit81d6d9f99ce8ea56df2c926156a3e3600a1a4117 (patch)
tree4c61b3d51d7a7aa2da786053d10b74ca642467d6 /src/Parser/Expr.hs
parentd361b5cb163316d4e0c56cab30301e18b548afff (diff)
Polymorphic types in function arguments
Diffstat (limited to 'src/Parser/Expr.hs')
-rw-r--r--src/Parser/Expr.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Parser/Expr.hs b/src/Parser/Expr.hs
index 53bd1a1..8d1fe03 100644
--- a/src/Parser/Expr.hs
+++ b/src/Parser/Expr.hs
@@ -426,17 +426,17 @@ recordSelector (SomeExpr expr) = do
checkFunctionArguments :: FunctionArguments SomeArgumentType
-> Int -> Maybe ArgumentKeyword -> SomeExpr -> TestParser SomeExpr
-checkFunctionArguments (FunctionArguments argTypes) poff kw sexpr@(SomeExpr expr) = do
+checkFunctionArguments (FunctionArguments argTypes) poff kw expr = do
case M.lookup kw argTypes of
- Just (SomeArgumentType (_ :: ArgumentType expected)) -> do
- withRecovery (\e -> registerParseError e >> return sexpr) $ do
- SomeExpr <$> unifyExpr poff (Proxy @expected) expr
+ Just (SomeArgumentType _ stype) -> do
+ withRecovery (\e -> registerParseError e >> return expr) $ do
+ unifySomeExpr poff stype expr
Nothing -> do
registerParseError $ FancyError poff $ S.singleton $ ErrorFail $ T.unpack $
case kw of
Just (ArgumentKeyword tkw) -> "unexpected parameter with keyword ‘" <> tkw <> "’"
Nothing -> "unexpected parameter"
- return sexpr
+ return expr
functionArguments :: (Int -> Maybe ArgumentKeyword -> a -> TestParser b) -> TestParser a -> TestParser a -> (Int -> Text -> TestParser a) -> TestParser (FunctionArguments b)