summaryrefslogtreecommitdiff
path: root/src/Script/Var.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-09-28 20:38:18 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-09-28 20:38:18 +0200
commit57c27f313e9f28548aec19e58b1497b79d7d5335 (patch)
tree6c4eaa4e64be6b7e6eb46133df018ce44c0a2ad7 /src/Script/Var.hs
parentc55f3775c9ce7842021a6e90db0437dce41cbecb (diff)
Additional instances of ExprType used by parsed commands
Diffstat (limited to 'src/Script/Var.hs')
-rw-r--r--src/Script/Var.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Script/Var.hs b/src/Script/Var.hs
index 668060c..2c50101 100644
--- a/src/Script/Var.hs
+++ b/src/Script/Var.hs
@@ -9,6 +9,8 @@ module Script.Var (
import Data.Text (Text)
import Data.Text qualified as T
+import Script.Expr.Class
+
newtype VarName = VarName Text
deriving (Eq, Ord)
@@ -40,6 +42,10 @@ unqualifyName (LocalVarName name) = name
newtype TypedVarName a = TypedVarName { fromTypedVarName :: VarName }
deriving (Eq, Ord)
+instance ExprType a => ExprType (TypedVarName a) where
+ textExprType _ = "TypedVarName"
+ textExprValue = textVarName . fromTypedVarName
+
newtype ModuleName = ModuleName [ Text ]
deriving (Eq, Ord, Show)
@@ -54,3 +60,7 @@ data SourceLine
textSourceLine :: SourceLine -> Text
textSourceLine (SourceLine text) = text
textSourceLine SourceLineBuiltin = "<builtin>"
+
+instance ExprType SourceLine where
+ textExprType _ = "SourceLine"
+ textExprValue = textSourceLine