summaryrefslogtreecommitdiff
path: root/src/Parser
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-11-30 19:31:49 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2024-12-02 20:48:22 +0100
commit57516242357cba015cc5e99e28d7f5e87dc5d7e8 (patch)
treedb29e6b02310650e421f573d3cd3b5add69fd820 /src/Parser
parent1670b628cc7accea1c7ecd9359a7dccb6bd50a45 (diff)
Trace regex variables in expect using new type
Diffstat (limited to 'src/Parser')
-rw-r--r--src/Parser/Statement.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Parser/Statement.hs b/src/Parser/Statement.hs
index 21b24a6..a65227d 100644
--- a/src/Parser/Statement.hs
+++ b/src/Parser/Statement.hs
@@ -153,6 +153,12 @@ instance (ParamType a, ParamType b) => ParamType (Either a b) where
paramFromSomeExpr _ se = (Left <$> paramFromSomeExpr @a Proxy se) <|> (Right <$> paramFromSomeExpr @b Proxy se)
paramExpr = either (fmap Left . paramExpr) (fmap Right . paramExpr)
+instance ExprType a => ParamType (Traced a) where
+ type ParamRep (Traced a) = Expr a
+ parseParam _ = parseParam (Proxy @(Expr a))
+ showParamType _ = showParamType (Proxy @(Expr a))
+ paramExpr = Trace
+
data SomeParam f = forall a. ParamType a => SomeParam (Proxy a) (f (ParamRep a))
data CommandDef a = CommandDef [(String, SomeParam Proxy)] ([SomeParam Identity] -> Expr a)