From 57c27f313e9f28548aec19e58b1497b79d7d5335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 28 Sep 2025 20:38:18 +0200 Subject: Additional instances of ExprType used by parsed commands --- src/Script/Expr/Class.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Script/Expr') diff --git a/src/Script/Expr/Class.hs b/src/Script/Expr/Class.hs index 005b6a8..810b0c8 100644 --- a/src/Script/Expr/Class.hs +++ b/src/Script/Expr/Class.hs @@ -79,3 +79,13 @@ instance ExprType a => ExprType [a] where textExprValue x = "[" <> T.intercalate ", " (map textExprValue x) <> "]" exprListUnpacker _ = Just $ ExprListUnpacker id (const Proxy) + +instance ExprType a => ExprType (Maybe a) where + textExprType _ = textExprType @a Proxy <> "?" + textExprValue (Just x) = textExprValue x + textExprValue Nothing = "Nothing" + +instance (ExprType a, ExprType b) => ExprType (Either a b) where + textExprType _ = textExprType @a Proxy <> "|" <> textExprType @b Proxy + textExprValue (Left x) = "Left " <> textExprValue x + textExprValue (Right x) = "Right " <> textExprValue x -- cgit v1.2.3