summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Data/Yaml/Extended.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Data/Yaml/Extended.hs b/src/Data/Yaml/Extended.hs
index 099e945..1600bab 100644
--- a/src/Data/Yaml/Extended.hs
+++ b/src/Data/Yaml/Extended.hs
@@ -7,12 +7,14 @@ module Data.Yaml.Extended
import qualified Data.Text as T
import qualified Data.Vector as V
import Data.Yaml
+import Data.Scientific
toString :: Value -> Maybe String
toString (String t) = Just (T.unpack t)
toString (Bool True) = Just "true"
toString (Bool False) = Just "false"
-toString (Number d) = Just (show d)
+toString (Number d) | isInteger d = Just (formatScientific Fixed (Just 0) d)
+ | otherwise = Just (show d)
toString _ = Nothing
toList :: Value -> Maybe [Value]