libhbb-0.4.1.0: Backend for text editors to provide better Haskell editing support.

Safe HaskellNone

Language.Haskell.HBB.Internal.TTreeJSON

Synopsis

Documentation

encodeTTreeToJSON :: (RealSrcSpan, TTree LineBuf (RealSrcSpan, Int) BufSpan) -> ByteStringSource

This function converts the tranformation-tree to JSON.

This is an example of a tree containing two addition which has been converted to JSON (the JSON-code has been layouted to make it more readable):

 {
     "addition-text": "()",
     "children": [
         {
             "addition-text": "\x -> \"hello \" ++ x",
             "children": [],
             "cover-range": "1:2-1:2"
         }
     ],
     "cover-range": "examples/PlayHelloPattern.hs,17:16-17:21"
 }

decodeTTreeFromJSON :: ByteString -> Either String (RealSrcSpan, TTree LineBuf (RealSrcSpan, Int) BufSpan)Source

This is the function that allows the deserialization of the Transformation-Tree from JSON.