summaryrefslogtreecommitdiff
path: root/src/Test.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-02-05 20:46:04 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2023-02-05 20:46:04 +0100
commit4603b8e9b1d2b99b8286c82d55ac18ba00fe7331 (patch)
tree3041c6fde414555d1f046cc8fd4a5d999ed883bf /src/Test.hs
parent30b2adf6f0caa11c5d11ff712290c0a60c37afde (diff)
List expression type
Diffstat (limited to 'src/Test.hs')
-rw-r--r--src/Test.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Test.hs b/src/Test.hs
index b2644b6..b6a85ae 100644
--- a/src/Test.hs
+++ b/src/Test.hs
@@ -96,6 +96,11 @@ instance ExprType Regex where
textExprValue _ = T.pack "<regex>"
emptyVarValue = either error id $ regexCompile T.empty
+instance ExprType a => ExprType [a] where
+ textExprType _ = "[" <> textExprType @a Proxy <> "]"
+ textExprValue x = "[" <> T.intercalate ", " (map textExprValue x) <> "]"
+ emptyVarValue = []
+
data SomeVarValue = forall a. ExprType a => SomeVarValue a
data RecordSelector a = forall b. ExprType b => RecordSelector (a -> b)