packages feed

hexml-lens 0.2.1 → 0.2.2

raw patch · 6 files changed

+38/−61 lines, 6 filesdep −QuickCheckdep −doctestdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: QuickCheck, doctest

Dependency ranges changed: base

API changes (from Hackage documentation)

- Main: main :: IO ()
- Text.XML.Hexml.Lens: instance Text.XML.Hexml.Lens.XML Foundation.Primitive.UTF8.Base.String
+ Text.XML.Hexml.Lens: instance Text.XML.Hexml.Lens.XML Basement.UTF8.Base.String

Files

README.md view
@@ -1,10 +1,10 @@ # hexml-lens [![Hackage](https://img.shields.io/hackage/v/hexml-lens.svg)](https://hackage.haskell.org/package/hexml-lens) [![Stackage Nightly](http://stackage.org/package/hexml-lens/badge/nightly)](http://stackage.org/nightly/package/hexml-lens)-[![Travis Build Status](https://travis-ci.org/pepeiborra/hexml-lens.svg)](https://travis-ci.org/pepeiborra/hexml-lens)+[![GitHub CI](https://github.com/pepeiborra/hexml-lens/workflows/CI/badge.svg)](https://github.com/pepeiborra/hexml-lens/actions)  Folds and getters for the Hexml `Node` type.-```+```haskell {-# LANGUAGE RecordWildCards #-} import Control.Lens hiding (children) import qualified Data.ByteString as B@@ -26,7 +26,7 @@ main = do   r <- get url   let stripDocType = LB.unlines . drop 2 . LB.lines-  let courses = take 10 $ r ^.. responseBody . to stripDocType . _XML . _children . courseF+  let courses = take 10 $ r ^.. responseBody . to stripDocType . _XML . _children . folded . courseF   print courses  courseF :: Fold Node (Course B.ByteString)
examples/courses.hs view
@@ -19,8 +19,8 @@ import           Text.XML.Hexml.Lens  url,url2 :: String-url = "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/courses/reed.xml"-url2 = "http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/courses/uwm.xml"+url = "https://web.archive.org/web/20200211134934if_/http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/courses/reed.xml"+url2 = "https://web.archive.org/web/20171112123740if_/http://aiweb.cs.washington.edu:80/research/projects/xmltk/xmldata/data/courses/uwm.xml"  type Strings = String 
hexml-lens.cabal view
@@ -1,9 +1,6 @@--- This file has been generated from package.yaml by hpack version 0.17.1.------ see: https://github.com/sol/hpack-+cabal-version: 2.2 name:           hexml-lens-version:        0.2.1+version:        0.2.2 synopsis:       Lenses for the hexml package description:    Lenses for the hexml package category:       lens@@ -11,19 +8,15 @@ author:         Jose Iborra maintainer:     pepeiborra@gmail.com copyright:      All Rights Reserved-license:        BSD3+license:        BSD-3-Clause license-file:   LICENSE build-type:     Simple-cabal-version:  >= 1.10- extra-source-files:     README.md -library-  hs-source-dirs:-      src+common depends   build-depends:-      base >= 4.7 && < 5+      base >=4.7 && <5     , bytestring     , contravariant     , foundation@@ -31,34 +24,29 @@     , lens     , profunctors     , text++library+  import: depends+  autogen-modules:+      Paths_hexml_lens   exposed-modules:-      Main       Text.XML.Hexml.Lens+  other-modules:+      Paths_hexml_lens+  hs-source-dirs:+      src   default-language: Haskell2010  test-suite courses+  import: depends   type: exitcode-stdio-1.0   main-is: courses.hs+  other-modules:+      Paths_hexml_lens   hs-source-dirs:       examples   build-depends:-      base-    , bytestring-    , hexml-    , hexml-lens+      hexml-lens     , hspec-    , lens     , wreq-  default-language: Haskell2010--test-suite doctests-  type: exitcode-stdio-1.0-  main-is: Doctests.hs-  hs-source-dirs:-      test-  build-depends:-      base-    , doctest-    , hexml-lens-    , QuickCheck   default-language: Haskell2010
− src/Main.hs
@@ -1,5 +0,0 @@-module Main where--main :: IO ()-main = do-  putStrLn "hello world"
src/Text/XML/Hexml/Lens.hs view
@@ -11,7 +11,6 @@   , multiple   ) where -import           Control.Arrow import           Control.Lens               hiding (children) import qualified Data.ByteString            as Strict import qualified Data.ByteString.Internal   as Strict@@ -66,6 +65,7 @@   -- >>> parse "<foo/>" ^? _Right.re(_XML @String)._XML.to name   -- Just "foo"   _XML :: Prism' s Node+   -- | Fold over all the children (text and element)   _contents :: Fold Node (Either s Node)   -- | Getter for the 'inner' contents of a node@@ -89,23 +89,24 @@ node n = nodes n . folded  instance XML String where-  _XML = strictUtf8 . _XML @ Strict.ByteString+  _XML = strictUtf8 . _XML @Strict.ByteString   _contents = _contents . firsting (from strictUtf8)   _inner = _inner . from strictUtf8   _outer = _outer . from strictUtf8   textContents = textContents @Strict.ByteString . from strictUtf8   _Attribute n = _Attribute(n ^. packedChars).mapping(from strictUtf8)-  iattributes  = iattributes @ Strict.ByteString . unpackedChars+  iattributes  = iattributes @Strict.ByteString . unpackedChars   nodes name_ = nodes ( name_ ^. strictUtf8)  instance XML F.String where-  _contents  = _contents . lefting (foundation F.UTF8)-  _inner = _inner . foundation F.UTF8-  _outer = _outer . foundation F.UTF8-  textContents = textContents . foundation F.UTF8-  _Attribute n = pre $ to (`attributeBy` (F.toList n ^. packedChars)) . folded . to attributeValue . foundation F.UTF8+  _XML = foundationUtf8 . _XML+  _contents  = _contents . firsting (from foundationUtf8)+  _inner = _inner . from foundationUtf8+  _outer = _outer . from foundationUtf8+  textContents = textContents . from foundationUtf8+  _Attribute n = _Attribute(n ^. foundationUtf8).mapping(from foundationUtf8)   iattributes  = iattributes . to fromString-  nodes name_ = nodes ( F.toList name_ ^. strictUtf8)+  nodes name_ = nodes ( name_ ^. foundationUtf8)  instance XML Strict.Text where   _XML = strictTextUtf8 . _XML@@ -142,7 +143,7 @@   nodes name_ = to $ flip childrenBy name_  instance XML Lazy.ByteString where-  _XML = strict . _XML @ Strict.ByteString+  _XML = strict . _XML @Strict.ByteString   _contents  = _contents . firsting lazy   _inner = _inner . lazy   _outer = _outer . lazy@@ -160,14 +161,11 @@ strictUtf8 :: Iso' String Strict.ByteString strictUtf8 = packed . strictTextUtf8 -foundation :: F.Encoding -> Getter Strict.ByteString F.String-foundation encoding = to (F.fromBytes encoding . fromByteString) . {-. filtered (hasn't (_2.folded))-} _1+foundationUtf8 :: Iso' F.String Strict.ByteString+foundationUtf8 = iso toByteString fromByteString   where-    fromByteString = F.fromForeignPtr . Strict.toForeignPtr---- | A more restricted version of 'firsting' which works on 'Fold's-lefting :: Fold l l' -> Fold (Either l a) (Either l' a)-lefting fold = runFold (left $ Fold fold)+    toByteString = Strict.packBytes . F.toList . F.toBytes F.UTF8+    fromByteString = view _1 . F.fromBytes F.UTF8 . F.fromForeignPtr . Strict.toForeignPtr  multiple :: Getting [a] s a -> IndexPreservingGetter s [a] multiple l = dimap (getConst #. l (Const #. (:[]))) phantom
− test/Doctests.hs
@@ -1,4 +0,0 @@-import Test.DocTest--main :: IO ()-main = doctest ["-isrc", "src/Text/XML/Hexml/Lens.hs"]