@@ -21,6 +21,7 @@ module Data.Yaml.Builder
2121import Data.Conduit
2222import Data.ByteString (ByteString)
2323import Text.Libyaml
24+import Data.Yaml.Internal
2425import Data.Text (Text)
2526import Data.Scientific (Scientific)
2627import Data.Aeson.Types (Value(..))
@@ -85,23 +86,6 @@ string s =
8586 -- See: https://github.com/snoyberg/yaml/issues/31
8687 | s `HashSet.member` specialStrings || isNumeric s = EventScalar (encodeUtf8 s) NoTag SingleQuoted Nothing
8788 | otherwise = EventScalar (encodeUtf8 s) StrTag PlainNoTag Nothing
88−
89− -- | Strings which must be escaped so as not to be treated as non-string scalars.
90− specialStrings :: HashSet.HashSet Text
91− specialStrings = HashSet.fromList $ T.words
92− "y Y yes Yes YES n N no No NO true True TRUE false False FALSE on On ON off Off OFF null Null NULL ~"
93−
94− isNumeric :: Text -> Bool
95− isNumeric =
96− T.all isNumeric'
97− where
98− isNumeric' c = ('0' <= c && c <= '9')
99− || c == 'e'
100− || c == 'E'
101− || c == '.'
102− || c == '-'
103− || c == '+'
104−
10589
10690-- Use aeson's implementation which gets rid of annoying decimal points
10791scientific :: Scientific -> YamlBuilder