diff options
Diffstat (limited to 'src/Script/Expr/Class.hs')
-rw-r--r-- | src/Script/Expr/Class.hs | 10 |
1 files changed, 10 insertions, 0 deletions
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 |