@@ -134,7 +134,7 @@ objToEvents' (String s) rest =
135 -- Make sure that special strings are encoded as strings properly.
135 -- Make sure that special strings are encoded as strings properly.
136 -- See: https://github.com/snoyberg/yaml/issues/31
136 -- See: https://github.com/snoyberg/yaml/issues/31
137− | s `HashSet.member` specialStrings = EventScalar (encodeUtf8 s) NoTag SingleQuoted Nothing
137+ | s `HashSet.member` specialStrings || isNumeric s = EventScalar (encodeUtf8 s) NoTag SingleQuoted Nothing
138 | otherwise = EventScalar (encodeUtf8 s) StrTag PlainNoTag Nothing
138 | otherwise = EventScalar (encodeUtf8 s) StrTag PlainNoTag Nothing
139objToEvents' Null rest = EventScalar "null" NullTag PlainNoTag Nothing : rest
139objToEvents' Null rest = EventScalar "null" NullTag PlainNoTag Nothing : rest
140objToEvents' (Bool True) rest = EventScalar "true" BoolTag PlainNoTag Nothing : rest
140objToEvents' (Bool True) rest = EventScalar "true" BoolTag PlainNoTag Nothing : rest
@@ -151,6 +151,16 @@ specialStrings :: HashSet.HashSet Text
151specialStrings = HashSet.fromList $ T.words
151specialStrings = HashSet.fromList $ T.words
152 "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 ~"
152 "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 ~"
154+isNumeric :: Text -> Bool
158+ isNumeric' c = ('0' <= c && c <= '9')
154-- Parsing
164-- Parsing
156data ParseException = NonScalarKey
166data ParseException = NonScalarKey