1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Define a ToJSONFields instance for SourceSpan.

This commit is contained in:
Rob Rix 2017-04-27 18:51:41 -04:00
parent 70dd381f26
commit 862fb3654b

View File

@ -96,6 +96,9 @@ instance ToJSONFields Range where
instance ToJSONFields Category where
toJSONFields c = ["category" .= case c of { Other s -> s ; _ -> toS c }]
instance ToJSONFields SourceSpan where
toJSONFields SourceSpan{..} = [ "start" .= spanStart, "end" .= spanEnd ]
instance ToJSONFields a => ToJSONFields (Maybe a) where
toJSONFields = maybe [] toJSONFields