summaryrefslogtreecommitdiff
path: root/src/Script
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-04-18 22:57:05 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-04-18 22:57:29 +0200
commitc824435064ea288a758687d00777804f0a2d5af3 (patch)
tree9c88749e3b194d0f23bdbeb0feedaca23e24573c /src/Script
parentc228afee9bb0058789a60295f43ffe04484a41be (diff)
Allow arbitrary types within DynVariableHEADmaster
Diffstat (limited to 'src/Script')
-rw-r--r--src/Script/Expr.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Script/Expr.hs b/src/Script/Expr.hs
index de66412..0941ffa 100644
--- a/src/Script/Expr.hs
+++ b/src/Script/Expr.hs
@@ -56,7 +56,7 @@ import Util
data Expr a where
Let :: forall a b. ExprType b => SourceLine -> TypedVarName b -> Expr b -> Expr a -> Expr a
Variable :: ExprType a => SourceLine -> FqVarName -> Expr a
- DynVariable :: TypeVar -> SourceLine -> FqVarName -> Expr DynamicType
+ DynVariable :: SomeExprType -> SourceLine -> FqVarName -> Expr DynamicType
FunVariable :: ExprType a => FunctionArguments SomeArgumentType -> SourceLine -> FqVarName -> Expr (FunctionType a)
ArgsReq :: ExprType a => FunctionArguments ( VarName, SomeArgumentType ) -> Expr (FunctionType a) -> Expr (FunctionType a)
ArgsApp :: ExprType a => FunctionArguments SomeExpr -> Expr (FunctionType a) -> Expr (FunctionType a)
@@ -274,7 +274,7 @@ someExprType (SomeExpr expr) = go expr
where
go :: forall e. ExprType e => Expr e -> SomeExprType
go = \case
- DynVariable tvar _ _ -> ExprTypeVar tvar
+ DynVariable stype _ _ -> stype
(e :: Expr a)
| IsFunType <- asFunType e -> ExprTypeFunction (gof e) (proxyOfFunctionType e)
| otherwise -> ExprTypePrim (Proxy @a)
@@ -304,9 +304,7 @@ renameTypeVar a b = go
go orig = case orig of
Let sline vname x y -> Let sline vname (go x) (go y)
Variable {} -> orig
- DynVariable tvar sline name
- | tvar == a -> DynVariable b sline name
- | otherwise -> orig
+ DynVariable stype sline name -> DynVariable (renameVarInType a b stype) sline name
FunVariable {} -> orig
ArgsReq args body -> ArgsReq args (go body)
ArgsApp args fun -> ArgsApp (fmap (renameTypeVarInSomeExpr a b) args) (go fun)