packages feed

json-ast 0.2 → 0.3.2

raw patch · 3 files changed

Files

− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
json-ast.cabal view
@@ -1,10 +1,33 @@ name:   json-ast version:-  0.2+  0.3.2 synopsis:   Universal JSON AST datastructure description:+  This library provides only a data-type representing the JSON value tree.+  It is intended to be used as a shared data-type by all kinds of JSON libraries.+  Same as we have the \"xml-types\" package for libraries dealing with XML.+  .+  Now, since the \"aeson\" @Value@ has been serving this purpose for years,+  we've intentionally made this type representationally identical to it,+  making it possible to convert between them at 0 runtime cost.+  This means that we can use those types interchangeably,+  making it possible to gradually migrate.+  .+  ===Why displace the \"aeson\" @Value@?+  .+  1. To boost the competition between JSON libraries.+  Instead of nudging the community to implement its ideas by patching \"aeson\".+  After all, competition is the driving force of evolution and hence progress.+  .+  2. Due to so much patching already happening to \"aeson\",+  its loss of focus, some questionable design and+  strive for backwards compatibility, it's becoming bloated.+  IOW, it's trying to be "everything JSON" but with no careful design or plan and+  it's tied by its past.+  With these restrictions it's impossible for \"aeson\" to ever become a polished+  library. homepage:   https://github.com/nikita-volkov/json-ast  bug-reports:@@ -39,13 +62,12 @@     NoImplicitPrelude, DeriveDataTypeable   default-language:     Haskell2010-  other-modules:   exposed-modules:     JSONAST   build-depends:     -- data:-    vector >= 0.10 && < 0.12,-    text >= 1 && < 2,+    vector >= 0.10 && < 0.14,+    text >= 1 && < 3,     scientific >= 0.3 && < 0.4,     unordered-containers >= 0.2 && < 0.3,     -- general:
library/JSONAST.hs view
@@ -1,3 +1,7 @@+{-|+This module will never contain any namespace conflicts with Prelude,+so it can be imported unqualified.+-} module JSONAST where  import Prelude@@ -8,18 +12,23 @@ import Data.Scientific (Scientific)  --- |--- A JSON value AST.--- --- Note that this datastructure is identical to \"aeson\" Value.--- Until \"aeson\" implements the dependency on \"json-ast\",--- you can use "Unsafe.Coerce.unsafeCoerce" to work with it,--- thus sidestepping the redundant conversions.+{-|+JSON value abstract syntax tree.++It is intended to be used instead of \"aeson\" @Value@ as lingua franca+for JSON libraries, removing the need to depend on \"aeson\" when all that's needed+is a representation of a JSON value.++Note that this datastructure is representationally identical to \"aeson\" @Value@.+Meaning that conversions between them can be made at 0 performance cost,+(using the 'Unsafe.Coerce.unsafeCoerce' function).+The \"aeson-json-ast\" package provides a typed interface for such conversions.+-} data JSON =-  Object !(HashMap Text JSON) |-  Array !(Vector JSON) |-  String !Text |-  Number !Scientific |-  Bool !Bool |-  Null+  JSON_Object !(HashMap Text JSON) |+  JSON_Array !(Vector JSON) |+  JSON_String !Text |+  JSON_Number !Scientific |+  JSON_Bool !Bool |+  JSON_Null   deriving (Eq, Read, Show, Typeable, Data)