Copyright | (c) Microsoft |
---|---|
License | MIT |
Maintainer | adamsap@microsoft.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
FromJSON and ToJSON instances
This module defines FromJSON
and ToJSON
instances for Bond abstract
syntax tree. They allow using the aeson
library to encode Bond AST types to JSON format:
> encode (Bond [] [Namespace Nothing ["example"]] []) "{\"namespaces\":[{\"name\":[\"example\"]}],\"imports\":[],\"declarations\":[]}"
and decode Bond data types from JSON:
> decode "{\"namespaces\":[{\"name\":[\"example\"]}],\"imports\":[],\"declarations\":[]}" :: Maybe Bond Just (Bond {bondImports = [], bondNamespaces = [Namespace {nsLanguage = Nothing, nsName = ["example"]}], bondDeclarations = []})