summaryrefslogtreecommitdiff
path: root/src/Data/Yaml/Extended.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Yaml/Extended.hs')
-rw-r--r--src/Data/Yaml/Extended.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Data/Yaml/Extended.hs b/src/Data/Yaml/Extended.hs
new file mode 100644
index 0000000..9ad05f3
--- /dev/null
+++ b/src/Data/Yaml/Extended.hs
@@ -0,0 +1,17 @@
+module Data.Yaml.Extended
+ ( module Data.Yaml
+ , toString
+ , toList
+ ) where
+
+import qualified Data.Text as T
+import qualified Data.Vector as V
+import Data.Yaml
+
+toString :: Value -> Maybe String
+toString (String t) = Just (T.unpack t)
+toString _ = Nothing
+
+toList :: Value -> Maybe [Value]
+toList (Array a) = Just (V.toList a)
+toList _ = Nothing