sugar-json 0.0.0 → 0.0.1
raw patch · 5 files changed
+33/−47 lines, 5 filesdep +hspecdep −text-showdep ~sugar
Dependencies added: hspec
Dependencies removed: text-show
Dependency ranges changed: sugar
Files
- LICENSE +11/−26
- src/Sugar/Json.hs +3/−3
- sugar-json.cabal +6/−6
- test-suite/Main.hs +0/−12
- tests/Main.hs +13/−0
LICENSE view
@@ -1,29 +1,14 @@-BSD 3-Clause License--Copyright (c) 2022, Joe Vargas-All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:--* Redistributions of source code must retain the above copyright notice, this- list of conditions and the following disclaimer.+The BSD Zero Clause License (0BSD) -* Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.+Copyright (c) 2022 Joe Vargas. -* Neither the name of the copyright holder nor the names of its- contributors may be used to endorse or promote products derived from- this software without specific prior written permission.+Permission to use, copy, modify, and/or distribute this software for any+purpose with or without fee is hereby granted. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR+PERFORMANCE OF THIS SOFTWARE.
src/Sugar/Json.hs view
@@ -10,7 +10,6 @@ import Data.Text (Text) import Data.Map (Map) import Data.Scientific (floatingOrInteger)-import TextShow (showt) import qualified Data.Map as Map @@ -27,6 +26,7 @@ import qualified Data.Aeson as Json import qualified Data.Vector as V import qualified Data.Text.IO as TIO+import qualified Data.Text as T import Sugar @@ -87,11 +87,11 @@ instance ToSugarCube Json.Value where toSugarCube Json.Null = SugarCube'Unit- toSugarCube (Json.Bool b) = SugarCube'Text (showt b)+ toSugarCube (Json.Bool b) = SugarCube'Text (T.pack $ show b) toSugarCube (Json.String t) = SugarCube'Text t toSugarCube (Json.Number n) = SugarCube'Text (showNumber n) where- showNumber s = either showt showt $ (floatingOrInteger s :: Either Double Integer)+ showNumber s = T.pack $ either show show $ (floatingOrInteger s :: Either Double Integer) toSugarCube (Json.Array a) = SugarCube'List $ map toSugarCube (V.toList a) toSugarCube (Json.Object o) = SugarCube'Map . Map.fromList . map (\(k,v) -> (keyText k, toSugarCube v)) . KeyMap.toList $ o where
sugar-json.cabal view
@@ -1,5 +1,5 @@ name: sugar-json-version: 0.0.0+version: 0.0.1 synopsis: Sugar with JSON homepage: https://github.com/jxv/sugar#readme description: Please see the README on GitHub at <https://github.com/jxv/sugar#readme>@@ -7,7 +7,7 @@ bug-reports: https://github.com/jxv/sugar/issues author: Joe Vargas maintainer: Joe Vargas-license: MIT+license: OtherLicense license-file: LICENSE build-type: Simple cabal-version: 1.14@@ -37,22 +37,22 @@ , ordered-containers , safe , scientific- , sugar == 0.0.0+ , sugar == 0.0.1 , text , text-conversions- , text-show , unordered-containers , vector default-language: Haskell2010 -test-suite sugar-json-test-suite+test-suite sugar-json-tests type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs:- test-suite+ tests ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N build-depends: base+ , hspec , sugar , tasty , tasty-hspec
− test-suite/Main.hs
@@ -1,12 +0,0 @@-import qualified Test.Tasty-import Test.Tasty.Hspec--main :: IO ()-main = do- test <- testSpec "sugar" spec- Test.Tasty.defaultMain test--spec :: Spec-spec = parallel $ do- it "is trivially true" $ do- True `shouldBe` True
+ tests/Main.hs view
@@ -0,0 +1,13 @@+import qualified Test.Tasty+import Test.Tasty.Hspec+import Test.Hspec++main :: IO ()+main = do+ test <- testSpec "sugar" spec+ Test.Tasty.defaultMain test++spec :: Spec+spec = parallel $ do+ it "is trivially true" $ do+ True `shouldBe` True