| Safe Haskell | None |
|---|
Language.Haskell.HBB.Internal.TTreeJSON
- encodeTTreeToJSON :: (RealSrcSpan, TTree LineBuf (RealSrcSpan, Int) BufSpan) -> ByteString
- decodeTTreeFromJSON :: ByteString -> Either String (RealSrcSpan, TTree LineBuf (RealSrcSpan, Int) BufSpan)
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.