hexpat-lens 0.0.7 → 0.1.0
raw patch · 3 files changed
+18/−20 lines, 3 filesdep ~lens
Dependency ranges changed: lens
Files
- hexpat-lens.cabal +2/−2
- src/Text/XML/Expat/Lens/Generic.hs +8/−13
- src/Text/XML/Expat/Lens/Unqualified.hs +8/−5
hexpat-lens.cabal view
@@ -1,5 +1,5 @@ name: hexpat-lens-version: 0.0.7+version: 0.1.0 synopsis: Lenses for Hexpat. license: MIT license-file: LICENSE@@ -22,7 +22,7 @@ , deepseq >= 1.3 && < 1.4 , bytestring >= 0.10.0.2 && < 0.10.1 , hexpat >= 0.20 && < 0.21- , lens >= 3.9 && < 3.10+ , lens >= 4.0.7 && < 4.1 , hexpat-tagsoup == 0.1.* ghc-options: -Wall hs-source-dirs: src
src/Text/XML/Expat/Lens/Generic.hs view
@@ -88,13 +88,9 @@ {-# INLINE ins #-} {-# INLINE at #-} -instance (Eq tag, Applicative f) => Ixed f (NodeG c tag text) where- ix = ixAt--instance (Eq tag, Applicative f, Contravariant f)- => Contains f (NodeG c tag text) where- contains = containsAt-+instance (Eq tag) => Ixed (NodeG c tag text) where+ ix = ixAt+ instance Traversable f => Plated (NodeG f tag text) where plate = children . traverse {-# INLINE plate #-}@@ -137,18 +133,17 @@ -- 'Control.Lens.Fold.filtered' so the caveats there apply. -- | Traverses 'Element's which have a particular name.- named- :: (Choice p, Applicative f, Eq tag)- => tag -> Overloaded' p f (NodeG c tag text) (NodeG c tag text)+ :: (Eq a, Applicative f, Choice p) =>+ a -> Optic' p f (NodeG f1 a text) (NodeG f1 a text) named n = filtered $ maybe False (== n) . preview name {-# INLINE named #-} -- | @parameterized k v@ traverses 'Element's which match the value -- @v@ at the key @k@ in their attributes.--parameterized :: (Choice p, Applicative f, Eq tag, Eq text) =>- tag -> text -> Overloaded' p f (NodeG c tag text) (NodeG c tag text)+parameterized+ :: (Eq (IxValue a), Applicative f, Choice p, Ixed a) =>+ Index a -> IxValue a -> Optic' p f a a parameterized k v = filtered check where check u = case u ^? ix k . to (==v) of Just True -> True
src/Text/XML/Expat/Lens/Unqualified.hs view
@@ -19,7 +19,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeSynonymInstances #-}-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} module Text.XML.Expat.Lens.Unqualified (@@ -60,12 +60,15 @@ allNodes = G.allNodes {-# INLINE allNodes #-} -named :: (Choice p, Applicative f, Eq t) => t -> Overloaded' p f (UNode t) (UNode t)+named+ :: (Eq a, Applicative f, Choice p) =>+ a -> Optic' p f (NodeG f1 a text) (NodeG f1 a text) named = G.named {-# INLINE named #-}--parameterized :: (Choice p, Applicative f, Eq t, GenericXMLString t) =>- t -> t -> Overloaded' p f (UNode t) (UNode t)+ +parameterized+ :: (Eq (IxValue a), Applicative f, Choice p, Ixed a) =>+ Index a -> IxValue a -> Optic' p f a a parameterized = G.parameterized {-# INLINE parameterized #-}