From 81d6d9f99ce8ea56df2c926156a3e3600a1a4117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 25 Apr 2026 10:51:21 +0200 Subject: Polymorphic types in function arguments --- src/Parser.hs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/Parser.hs') diff --git a/src/Parser.hs b/src/Parser.hs index 191d40d..e3d174e 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -101,19 +101,9 @@ parseDefinition href = label "symbol definition" $ do getInferredTypes atypes = forM atypes $ \( off, vname, tvar@(TypeVar tvarname) ) -> do let err msg = do registerParseError . FancyError off . S.singleton . ErrorFail $ T.unpack msg - return ( vname, SomeArgumentType (OptionalArgument @DynamicType) ) - let getConcreteType = \case - (ExprTypeApp (ExprTypeConstr1 (Proxy :: Proxy a)) [ pb ]) - | ExprTypePrim (_ :: Proxy b) <- getConcreteType pb - -> ExprTypePrim (Proxy :: Proxy (a b)) - t -> t + return ( vname, SomeArgumentType OptionalArgument (ExprTypeForall (TypeVar "a") (ExprTypeVar (TypeVar "a"))) ) gets (M.lookup tvar . testTypeUnif) >>= \case - Just t - | ExprTypePrim (_ :: Proxy a) <- getConcreteType t - -> return ( vname, SomeArgumentType (RequiredArgument @a) ) - - | otherwise - -> err $ "expected concrete type for ‘" <> textVarName vname <> " : " <> textSomeExprType t <> "’" + Just t -> return ( vname, SomeArgumentType RequiredArgument t ) Nothing -> err $ "ambiguous type for ‘" <> textVarName vname <> " : " <> tvarname <> "’" replaceDynArgs :: forall a. Expr a -> TestParser (Expr a) -- cgit v1.2.3