packages feed

hexpat-lens 0.0.6 → 0.0.7

raw patch · 4 files changed

+21/−9 lines, 4 files

Files

hexpat-lens.cabal view
@@ -1,5 +1,5 @@ name:                hexpat-lens-version:             0.0.6+version:             0.0.7 synopsis:            Lenses for Hexpat. license:             MIT license-file:        LICENSE
src/Text/XML/Expat/Lens/Generic.hs view
@@ -20,6 +20,7 @@ {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE RankNTypes #-}  module Text.XML.Expat.Lens.Generic ( @@ -27,7 +28,7 @@   name, attributes, text,    -- * Recursive inspection-  children, allNodes,+  children, allNodes, (./),    -- * Filters   named, parameterized@@ -83,7 +84,7 @@         | key == key' = case mayRes of           Nothing  -> rest           Just res -> (key, res):rest-        | otherwise   = (key', res'):(ins key mayRes rest)+        | otherwise   = (key', res') : ins key mayRes rest       {-# INLINE ins #-}   {-# INLINE at #-} @@ -103,7 +104,7 @@ -- can think of it like the @?@ suffix modifier.  children :: Traversal' (NodeG f tag text) (f (NodeG f tag text))-children inj (Element n a c) = (\c' -> Element n a c') <$> inj c+children inj (Element n a c) = Element n a <$> inj c children _   t               = pure t {-# INLINE children #-} @@ -154,3 +155,10 @@     _         -> False   {-# INLINE check #-} {-# INLINE parameterized #-}+++-- | Glue two 'Traversal's together as relations. This is much like+-- @XPath@'s *slash*.++(./) :: Plated i => Traversal' s i -> Traversal' i a -> Traversal' s a+l ./ m = l . plate . m
src/Text/XML/Expat/Lens/Names.hs view
@@ -38,19 +38,19 @@   localPart :: Lens' (a t) t  prefix :: Lens' (QName text) (Maybe text)-prefix inj (QName pref part) = (\pref' -> QName pref' part) <$> inj pref+prefix inj (QName pref part) = (`QName` part) <$> inj pref {-# INLINE prefix #-}  instance HasLocalPart QName where-  localPart inj (QName pref part) = (\part' -> QName pref part') <$> inj part+  localPart inj (QName pref part) = QName pref <$> inj part   {-# INLINE localPart #-}  namespace :: Lens' (NName text) (Maybe text)-namespace inj (NName ns part) = (\ns' -> NName ns' part) <$> inj ns+namespace inj (NName ns part) = (`NName` part) <$> inj ns {-# INLINE namespace #-}  instance HasLocalPart NName where-  localPart inj (NName ns part) = (\part' -> NName ns part') <$> inj part+  localPart inj (NName ns part) = NName ns <$> inj part   {-# INLINE localPart #-}  -- | Iso between a node marked by a "stringy" name to one using a
src/Text/XML/Expat/Lens/Unqualified.hs view
@@ -20,6 +20,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE RankNTypes #-}  module Text.XML.Expat.Lens.Unqualified ( @@ -27,7 +28,7 @@   name, attributes, text,    -- * Recursive inspection-  children, allNodes,+  children, allNodes, (./),    -- * Filters   named, parameterized@@ -67,3 +68,6 @@                  t -> t -> Overloaded' p f (UNode t) (UNode t) parameterized = G.parameterized {-# INLINE parameterized #-}++(./) :: Plated i => Traversal' s i -> Traversal' i a -> Traversal' s a+(./) = (G../)