packages feed

xmlbf-xeno 0.2 → 0.2.1

raw patch · 6 files changed

+83/−29 lines, 6 filesdep +criteriondep +deepseqdep +ghc-primdep −QuickCheckdep −quickcheck-instancesdep −tasty-quickcheckdep ~basesetup-changed

Dependencies added: criterion, deepseq, ghc-prim, xml

Dependencies removed: QuickCheck, quickcheck-instances, tasty-quickcheck

Dependency ranges changed: base

Files

ChangeLog.md view
@@ -1,3 +1,10 @@+# 0.2.1++* Added benchmark.++* Removed unnecessary test dependencies.++ # 0.2  * COMPILER ASSISTED BREAKING CHANGE. Renamed `element` to `fromXenoNode`.
− Setup.hs
@@ -1,4 +0,0 @@-#! /usr/bin/env nix-shell-#! nix-shell ./shell.nix -i runghc-import Distribution.Simple-main = defaultMain
+ bench/Speed.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++-- | Benchmark speed.++module Main where++import           Control.DeepSeq+import           Criterion+import           Criterion.Main+import qualified Data.ByteString as S+import           GHC.Generics+import           Text.XML.Light as XML+import qualified Xmlbf.Xeno as Xeno++main :: IO ()+main =+  defaultMain+    [ env+        (S.readFile "data/books-4kb.xml")+        (\input -> bench "4KB" (whnf Xeno.fromRawXml input))+    , env+        (S.readFile "data/text-31kb.xml")+        (\input -> bench "31KB" (whnf Xeno.fromRawXml input))+    , env+        (S.readFile "data/fabricated-211kb.xml")+        (\input -> bench "211KB" (whnf Xeno.fromRawXml input))+    ]++deriving instance Generic Content+deriving instance Generic Element+deriving instance Generic CData+deriving instance Generic CDataKind+deriving instance Generic QName+deriving instance Generic Attr+instance NFData Content+instance NFData Element+instance NFData CData+instance NFData CDataKind+instance NFData QName+instance NFData Attr
lib/Xmlbf/Xeno.hs view
@@ -40,7 +40,7 @@ -- Haskell library, so all of @xeno@'s parsing quirks apply. -- -- You can provide the output of this function as input to "Xmlbf"'s--- 'Xmlbf.runParser'.+-- 'Xmlbf.parse'. -- -- The given XML can contain more zero or more text or element nodes. --@@ -50,7 +50,9 @@   -> Either String [Xmlbf.Node]   -- ^ 'Xmlbf.Node's from "Xmlbf" fromRawXml = \bs -> case Xeno.parse ("<x>" <> dropBomUtf8 bs <> "</x>") of   Left e -> Left ("Malformed XML: " ++ show e)-  Right n -> fromXenoNode n >>= \(Xmlbf.Element "x" _ cs) -> pure cs+  Right n -> fromXenoNode n >>= \case+    Xmlbf.Element "x" _ cs -> Right cs+    _ -> Left "Unknown result from fromXenoNode. Please report this as a bug."  -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
test/Test.hs view
@@ -5,19 +5,10 @@  module Main where -import Control.Applicative (many)-import qualified Data.ByteString as B-import qualified Data.ByteString.Builder as BB-import qualified Data.ByteString.Lazy as BL-import qualified Data.HashMap.Strict as HM-import qualified Data.Text as T import qualified Test.Tasty as Tasty import qualified Test.Tasty.Runners as Tasty-import Test.Tasty.QuickCheck ((===))-import qualified Test.Tasty.QuickCheck as QC import qualified Test.Tasty.HUnit as HU import           Test.Tasty.HUnit ((@?=))-import qualified Test.QuickCheck.Instances ()  import qualified Xmlbf as X import qualified Xmlbf.Xeno as Xx@@ -101,5 +92,3 @@      -- Test BOM presence      Xx.fromRawXml "\xEF\xBB\xBF<foo/>" @?= Xx.fromRawXml "<foo/>"   ]--
xmlbf-xeno.cabal view
@@ -1,23 +1,28 @@ name: xmlbf-xeno-version: 0.2+version: 0.2.1 synopsis: xeno backend support for the xmlbf library. homepage: https://gitlab.com/k0001/xmlbf+bug-reports: https://gitlab.com/k0001/xmlbf/issues license: Apache-2.0 license-file: LICENSE author: Renzo Carbonara maintainer: ren§ren*zone copyright: Copyright 2017-2018 Renzo Carbonara-category: Text+category: Text, XML build-type: Simple extra-source-files: ChangeLog.md README.md cabal-version: >=1.10 +source-repository head+  type: git+  location: https://gitlab.com/k0001/xmlbf+ library   hs-source-dirs: lib   exposed-modules: Xmlbf.Xeno   default-language: Haskell2010-  ghc-options: -O2 -Wall-  ghcjs-options: -O3 -Wall+  ghc-options: -O2 -Wall -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints+  ghcjs-options: -O3 -Wall -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints   build-depends:     base <5,     bytestring,@@ -32,15 +37,27 @@   type: exitcode-stdio-1.0   main-is: Test.hs   hs-source-dirs: test+  ghc-options: -O2 -Wall -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints+  ghcjs-options: -O3 -Wall -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints   build-depends:     base,-    bytestring,-    xmlbf,-    xmlbf-xeno,-    QuickCheck,-    quickcheck-instances,     tasty,     tasty-hunit,-    tasty-quickcheck,-    text,-    unordered-containers+    xmlbf,+    xmlbf-xeno++benchmark xmlbf-speed-bench+  type: exitcode-stdio-1.0+  hs-source-dirs: bench+  main-is: Speed.hs+  ghc-options: -Wall -O2+  ghcjs-options: -Wall -O3+  build-depends:+    base,+    bytestring,+    criterion,+    deepseq,+    ghc-prim,+    xml,+    xmlbf-xeno+  default-language: Haskell2010