packages feed

text-json-qq 0.2.0 → 0.3.0

raw patch · 2 files changed

+32/−71 lines, 2 filesdep ~base

Dependency ranges changed: base

Files

src/Text/JSON/QQ.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell -XQuasiQuotes -XUndecidableInstances #-}+{-# OPTIONS_GHC -XTemplateHaskell -XQuasiQuotes -XUndecidableInstances #-}  -- | This package expose the function @jsonQQ@ that compile time converts json code into a @Text.JSON.JSValue@. --    @jsonQQ@ got the signature@@ -7,17 +7,17 @@ --     --    and is used like --    ---    > myCode = [$jsonQQ| {age: 23, name: "Pelle", likes: ["mac","Haskell"] } |]+--    > myCode = [jsonQQ| {age: 23, name: "Pelle", likes: ["mac","Haskell"] } |] --     --    where it is important that --    ---    * you got no space in @[$jsonQQ|@ and+--    * you got no space in @[jsonQQ|@ and --     --    * no additional code after @|]@. --     --    The quasiquatation can also bind to variables like --    ---    > myCode = [$jsonQQ| {age: <|age|>, name: <|name|>} |]+--    > myCode = [jsonQQ| {age: <|age|>, name: <|name|>} |] --    > where age = 34 :: Integer --    >       name = "Pelle" --    @@ -25,17 +25,17 @@ -- --    You can also insert Haskell code:  -----    > myCode = [$jsonQQ| {age: <|age + 34 :: Integer|>, name: <|map toUpper name|>} |]+--    > myCode = [jsonQQ| {age: <|age + 34 :: Integer|>, name: <|map toUpper name|>} |] --    > where age = 34 :: Integer --    >       name = "Pelle" --     --    You can use a similar syntax if you want to insert a value of type JSValue like --    ---    > myCode = [$jsonQQ| {"age": <<age>>} |]+--    > myCode = [jsonQQ| {"age": <<age>>} |] --     --    If you want to replace the name of the key in a hash you'll use the $-syntax: --    ---    > foo = [$jsonQQ| {$bar: 42} |]+--    > foo = [jsonQQ| {$bar: 42} |] --    > bar = "age" --     @@ -60,7 +60,12 @@ import Language.Haskell.Meta.Parse  jsonQQ :: QuasiQuoter-jsonQQ = QuasiQuoter jsonExp jsonPat+jsonQQ = QuasiQuoter { +  quoteExp = jsonExp, +  quotePat = \s -> error "No quotePat defined for jsonQQ",+  quoteType = \s -> error "No quoteType defined for jsonQQ",+  quoteDec = \s -> error "No quoteDec defined for jsonQQ"+}   jsonExp :: String -> ExpQ@@ -70,10 +75,6 @@     Right val -> return $ toExp val   where     parsed' = parse jpValue "txt" txt--jsonPat :: String -> PatQ-jsonPat s = undefined-  ---- -- JSValue etc to ExpQ
text-json-qq.cabal view
@@ -1,19 +1,9 @@--- text-json-qq.cabal auto-generated by cabal init. For additional--- options, see--- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.--- The name of the package.-Name:                text-json-qq---- The package version. See the Haskell package versioning policy--- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for--- standards guiding when and how versions should be incremented.-Version:             0.2.0---- A short (one-line) description of the package.-Synopsis:            Json Quasiquatation for Haskell.+name:                text-json-qq+version:             0.3.0+synopsis:            Json Quasiquatation for Haskell.  -- A longer description of the package.-Description:  +description:       @text-json-qq@ provides json quasiquatation for Haskell.     .     This package expose the function @jsonQQ@ that compile time converts json code into a @Text.JSON.JSValue@.@@ -23,52 +13,22 @@     .     Consult documentation in the module @Text.JSON.QQ@. +homepage:            http://github.com/finnsson/text-json-qq+license:             OtherLicense+license-file:        COPYING.txt+author:              Oscar Finnsson+maintainer:          oscar.finnsson@gmail.com+category:            Text+build-type:          Simple+cabal-version:       >=1.6 +library+  hs-source-dirs: src+  exposed-modules: Text.JSON.QQ+  build-depends: base >= 4.3 && < 5, json, parsec >= 2 && < 3, template-haskell, haskell-src-meta >= 0.1.0 --- URL for the project homepage or repository.-Homepage:            http://github.com/finnsson/text-json-qq+source-repository head+  type:     git+  location: https://github.com/finnsson/text-json-qq/ --- The license under which the package is released.-License:             OtherLicense --- The file containing the license text.-License-file:        COPYING.txt---- The package author(s).-Author:              Oscar Finnsson---- An email address to which users can send suggestions, bug reports,--- and patches.-Maintainer:          oscar.finnsson@gmail.com---- A copyright notice.--- Copyright:           --Category:            Text--Build-type:          Simple---- Extra files to be distributed with the package, such as examples or--- a README.--- Extra-source-files:  ---- Constraint on the version of Cabal needed to build this package.-Cabal-version:       >=1.2--build-depends: base >= 4.2 && < 5, json, parsec >= 2 && < 3, template-haskell, haskell-src-meta >= 0.1.0--hs-source-dirs: src---- Library-  -- Modules exported by the library.-exposed-modules: Text.JSON.QQ-  -  -- Packages needed in order to build this package.-  -- build-depends:       base >= 4 < 5, json-  -  -- Modules not exported by this package.-  -- Other-modules:       -  -  -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.-  -- Build-tools:         -