lsp-types-2.1.0.0: Haskell library for the Microsoft Language Server Protocol, data types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Row.Aeson

Description

This module defines orphan aeson instances for Row. They differ from the instances in `row-types-aeson` in one crucial respect: they serialise Nothing fields by *omitting* them in the resulting object, and parse absent fields as Nothing. aeson can be configured to have this behviour for instances for datatypes, but we want to do this for record types generically.

This is crucial to match what LSP clients expect.

Synopsis

Documentation

class ToJSONEntry a where Source #

Serialise a value as an entry in a JSON object. This allows customizing the behaviour in the object context, in order to e.g. omit the field.

Methods

toJSONEntry :: String -> a -> Object Source #

Instances

Instances details
ToJSON a => ToJSONEntry a Source # 
Instance details

Defined in Data.Row.Aeson

Methods

toJSONEntry :: String -> a -> Object Source #

ToJSON a => ToJSONEntry (Maybe a) Source # 
Instance details

Defined in Data.Row.Aeson

class FromJSONEntry a where Source #

Instances

Instances details
FromJSON a => FromJSONEntry a Source # 
Instance details

Defined in Data.Row.Aeson

FromJSON a => FromJSONEntry (Maybe a) Source # 
Instance details

Defined in Data.Row.Aeson

lazyUncons :: KnownSymbol l => Label l -> Rec r -> (Rec (r .- l), r .! l) Source #

Orphan instances

(AllUniqueLabels r, Forall r FromJSONEntry) => FromJSON (Rec r) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Rec r) #

parseJSONList :: Value -> Parser [Rec r] #

Forall r ToJSONEntry => ToJSON (Rec r) Source # 
Instance details

Methods

toJSON :: Rec r -> Value #

toEncoding :: Rec r -> Encoding #

toJSONList :: [Rec r] -> Value #

toEncodingList :: [Rec r] -> Encoding #