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

Define a ToJSONFields instance for SourceText.

This commit is contained in:
Rob Rix 2017-04-27 19:22:22 -04:00
parent 59735e5dac
commit 9944b32d9f

View File

@ -95,6 +95,9 @@ instance ToJSONFields Category where
instance ToJSONFields SourceSpan where
toJSONFields SourceSpan{..} = [ "start" .= spanStart, "end" .= spanEnd ]
instance ToJSONFields SourceText where
toJSONFields (SourceText t) = [ "sourceText" .= t ]
instance ToJSONFields a => ToJSONFields (Maybe a) where
toJSONFields = maybe [] toJSONFields