packages feed

alignment 0.1.0.1 → 0.1.0.2

raw patch · 3 files changed

+66/−3 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Data.Alignment: allThoseAOr :: Traversal' (This f a b) [a]
+ Data.Alignment: allThoseBOr :: Traversal' (This f a b) [b]

Files

alignment.cabal view
@@ -1,7 +1,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                   alignment-version:                0.1.0.1+version:                0.1.0.2 synopsis:               Zip-alignment description:   <<https://system-f.gitlab.io/logo/systemf-450x450.jpg>>@@ -18,7 +18,7 @@ cabal-version:          >=1.10 homepage:               https://gitlab.com/system-f/alignment bug-reports:            https://gitlab.com/system-f/alignment/issues-tested-with:             GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1+tested-with:            GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1  source-repository       head   type:                 git
changelog.md view
@@ -1,3 +1,7 @@+0.1.0.2++* Add `allThoseAOr` and `allThoseBOr`.+ 0.1.0.1  * Add `alignWith`.
src/Data/Alignment.hs view
@@ -18,8 +18,10 @@ , allThose , allThoseA , allThoseA'+, allThoseAOr , allThoseB , allThoseB'+, allThoseBOr , allTheseThoseA , allTheseThoseB ) where@@ -47,7 +49,7 @@ import Data.Either ( Either(..) ) import Data.Eq ( Eq((==)) ) import Data.Foldable ( Foldable(foldMap) )-import Data.Functor ( Functor(fmap) )+import Data.Functor ( Functor(fmap), (<$) ) import Data.Functor.Apply ( Apply((<.>), liftF2) ) import Data.Functor.Classes     ( compare1,@@ -65,6 +67,9 @@ import Data.Traversable ( Traversable(traverse) ) import GHC.Show ( Show(showsPrec) ) +-- $setup+-- >>> import Prelude+ data This f a b =   This     (f (a, b))@@ -491,6 +496,33 @@  -- | --+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] Nothing)+-- This [("abc",'x'),("def",'y')] Nothing+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))+-- This [("abc",'x'),("def",'y')] Just (Left ("abc" :| ["def"]))+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))+-- This [("abc",'x'),("def",'y')] Just (Right ('e' :| "dcba"))+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] Nothing)+-- Just ""+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))+-- Nothing+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))+-- Just "abcde"+allThoseAOr ::+  Traversal'+    (This f a b)+    [a]+allThoseAOr f (This t Nothing) =+  This t <$> (Nothing <$ f [])+allThoseAOr _ th@(This _ (Just (Right _))) =+  pure th+allThoseAOr f (This t (Just (Left a))) =+  let lst [] = Nothing+      lst (x:y) = Just (x:|y)+  in  This t <$> (fmap Left . lst <$> f (NonEmpty.toList a))++-- |+-- -- >>> over allThoseB (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] Nothing) -- This [("abc",'x'),("def",'y')] Nothing -- >>> over allThoseB (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))@@ -531,6 +563,33 @@     b allThoseB' =   allThoseB . traverse++-- |+--+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] Nothing)+-- This [("abc",'x'),("def",'y')] Nothing+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))+-- This [("abc",'x'),("def",'y')] Just (Left ("abc" :| ["def"]))+-- >>> over allThoseBOr reverse (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))+-- This [("abc",'x'),("def",'y')] Just (Right ('e' :| "dcba"))+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] Nothing)+-- Just ""+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))+-- Nothing+-- >>> Control.Lens.preview allThoseBOr (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))+-- Just "abcde"+allThoseBOr ::+  Traversal'+    (This f a b)+    [b]+allThoseBOr f (This t Nothing) =+  This t <$> (Nothing <$ f [])+allThoseBOr f (This t (Just (Right b))) =+  let lst [] = Nothing+      lst (x:y) = Just (x:|y)+  in  This t <$> (fmap Right . lst <$> f (NonEmpty.toList b))+allThoseBOr _ th@(This _ (Just (Left _))) =+  pure th  -- | --