alignment-0.1.0.3: Zip-alignment
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Alignment

Synopsis

Types

data This f a b Source #

Constructors

This (f (a, b)) (Maybe (Either (NonEmpty a) (NonEmpty b))) 

Instances

Instances details
Functor f => Bifunctor (This f) Source # 
Instance details

Defined in Data.Alignment

Methods

bimap :: (a -> b) -> (c -> d) -> This f a c -> This f b d #

first :: (a -> b) -> This f a c -> This f b c #

second :: (b -> c) -> This f a b -> This f a c #

Functor f => Swap (This f) Source #
>>> swap (This [("abc", 'x'), ("def", 'y')] Nothing)
This [('x',"abc"),('y',"def")] Nothing
>>> swap (This [("abc", 'x'), ("def", 'y')] (Just (Left ("a":|[]))))
This [('x',"abc"),('y',"def")] Just (Right ("a" :| []))
>>> swap (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|[]))))
This [('x',"abc"),('y',"def")] Just (Left ('a' :| ""))
Instance details

Defined in Data.Alignment

Methods

swap :: This f a b -> This f b a #

Traversable f => Bitraversable (This f) Source # 
Instance details

Defined in Data.Alignment

Methods

bitraverse :: Applicative f0 => (a -> f0 c) -> (b -> f0 d) -> This f a b -> f0 (This f c d) #

Foldable f => Bifoldable (This f) Source # 
Instance details

Defined in Data.Alignment

Methods

bifold :: Monoid m => This f m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> This f a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> This f a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> This f a b -> c #

Functor f => Functor (This f a) Source # 
Instance details

Defined in Data.Alignment

Methods

fmap :: (a0 -> b) -> This f a a0 -> This f a b #

(<$) :: a0 -> This f a b -> This f a a0 #

(Monoid a, Applicative f) => Applicative (This f a) Source # 
Instance details

Defined in Data.Alignment

Methods

pure :: a0 -> This f a a0 #

(<*>) :: This f a (a0 -> b) -> This f a a0 -> This f a b #

liftA2 :: (a0 -> b -> c) -> This f a a0 -> This f a b -> This f a c #

(*>) :: This f a a0 -> This f a b -> This f a b #

(<*) :: This f a a0 -> This f a b -> This f a a0 #

(Eq1 f, Eq a) => Eq1 (This f a) Source # 
Instance details

Defined in Data.Alignment

Methods

liftEq :: (a0 -> b -> Bool) -> This f a a0 -> This f a b -> Bool #

(Ord1 f, Ord a) => Ord1 (This f a) Source # 
Instance details

Defined in Data.Alignment

Methods

liftCompare :: (a0 -> b -> Ordering) -> This f a a0 -> This f a b -> Ordering #

(Show1 f, Show a) => Show1 (This f a) Source # 
Instance details

Defined in Data.Alignment

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> This f a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [This f a a0] -> ShowS #

(Semigroup a, Apply f) => Apply (This f a) Source #
>>> This [("a", id), ("c", id)] Nothing <.> This [("A", "B"), ("C", "D")] Nothing
This [("aA","B"),("aC","D"),("cA","B"),("cC","D")] Nothing
>>> This [("a", id), ("c", id)] Nothing <.> This [("A", "B"), ("C", "D")] (Just (Left ("x":|[])))
This [("aA","B"),("aC","D"),("cA","B"),("cC","D")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] Nothing <.> This [("ABC", "DEF"), ("GHI", "JKL")] Nothing
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] Nothing <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Left ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] Nothing <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Right ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] (Just (Left ("stu":|[]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] Nothing
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] (Just (Right (id:|[reverse]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] Nothing
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Nothing
>>> This [("abc", reverse), ("cde", reverse)] (Just (Left ("stu":|[]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Left ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Just (Left ("stu" :| []))
>>> This [("abc", reverse), ("cde", reverse)] (Just (Left ("stu":|[]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Right ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Just (Left ("stu" :| []))
>>> This [("abc", reverse), ("cde", reverse)] (Just (Right (id:|[reverse]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Left ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Just (Left ("xyz" :| []))
>>> This [("abc", reverse), ("cde", reverse)] (Just (Left ("stu":|[]))) <.> This [("ABC", "DEF"), ("GHI", "JKL")] (Just (Right ("xyz":|[])))
This [("abcABC","FED"),("abcGHI","LKJ"),("cdeABC","FED"),("cdeGHI","LKJ")] Just (Left ("stu" :| []))
Instance details

Defined in Data.Alignment

Methods

(<.>) :: This f a (a0 -> b) -> This f a a0 -> This f a b #

(.>) :: This f a a0 -> This f a b -> This f a b #

(<.) :: This f a a0 -> This f a b -> This f a a0 #

liftF2 :: (a0 -> b -> c) -> This f a a0 -> This f a b -> This f a c #

(Eq1 f, Eq a, Eq b) => Eq (This f a b) Source # 
Instance details

Defined in Data.Alignment

Methods

(==) :: This f a b -> This f a b -> Bool #

(/=) :: This f a b -> This f a b -> Bool #

(Ord1 f, Ord a, Ord b) => Ord (This f a b) Source # 
Instance details

Defined in Data.Alignment

Methods

compare :: This f a b -> This f a b -> Ordering #

(<) :: This f a b -> This f a b -> Bool #

(<=) :: This f a b -> This f a b -> Bool #

(>) :: This f a b -> This f a b -> Bool #

(>=) :: This f a b -> This f a b -> Bool #

max :: This f a b -> This f a b -> This f a b #

min :: This f a b -> This f a b -> This f a b #

(Show1 f, Show a, Show b) => Show (This f a b) Source # 
Instance details

Defined in Data.Alignment

Methods

showsPrec :: Int -> This f a b -> ShowS #

show :: This f a b -> String #

showList :: [This f a b] -> ShowS #

Semigroup (This [] a b) Source #
>>> This [("abc", 's'), ("def", 't')] Nothing <> This [("ghi", 'u'), ("jkl", 'v')] Nothing
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Nothing
>>> This [("abc", 's'), ("def", 't')] Nothing <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Left ("mno":|["pqr"])))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Left ("mno" :| ["pqr"]))
>>> This [("abc", 's'), ("def", 't')] Nothing <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Right ('o':|"pqr")))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Right ('o' :| "pqr"))
>>> This [("abc", 's'), ("def", 't')] (Just (Left ("mno":|["pqr"]))) <> This [("ghi", 'u'), ("jkl", 'v')] Nothing
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Left ("mno" :| ["pqr"]))
>>> This [("abc", 's'), ("def", 't')] (Just (Right ('o':|"pqr"))) <> This [("ghi", 'u'), ("jkl", 'v')] Nothing
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Right ('o' :| "pqr"))
>>> This [("abc", 's'), ("def", 't')] (Just (Left ("mno":|["pqr"]))) <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Left ("ccddee":|["ffgghh"])))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Left ("mno" :| ["pqr","ccddee","ffgghh"]))
>>> This [("abc", 's'), ("def", 't')] (Just (Left ("mno":|["pqr"]))) <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Right ('c':|"ddeeff")))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v'),("mno",'c'),("pqr",'d')] Just (Right ('d' :| "eeff"))
>>> This [("abc", 's'), ("def", 't')] (Just (Right ('x':|"yyzz"))) <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Right ('c':|"ddeeff")))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v')] Just (Right ('x' :| "yyzzcddeeff"))
>>> This [("abc", 's'), ("def", 't')] (Just (Right ('x':|"yyzz"))) <> This [("ghi", 'u'), ("jkl", 'v')] (Just (Left ("cc":|["ddeeff"])))
This [("abc",'s'),("def",'t'),("ghi",'u'),("jkl",'v'),("cc",'x'),("ddeeff",'y')] Just (Right ('y' :| "zz"))
Instance details

Defined in Data.Alignment

Methods

(<>) :: This [] a b -> This [] a b -> This [] a b #

sconcat :: NonEmpty (This [] a b) -> This [] a b #

stimes :: Integral b0 => b0 -> This [] a b -> This [] a b #

Semigroup (This NonEmpty a b) Source # 
Instance details

Defined in Data.Alignment

Methods

(<>) :: This NonEmpty a b -> This NonEmpty a b -> This NonEmpty a b #

sconcat :: NonEmpty (This NonEmpty a b) -> This NonEmpty a b #

stimes :: Integral b0 => b0 -> This NonEmpty a b -> This NonEmpty a b #

Monoid (This [] a b) Source # 
Instance details

Defined in Data.Alignment

Methods

mempty :: This [] a b #

mappend :: This [] a b -> This [] a b -> This [] a b #

mconcat :: [This [] a b] -> This [] a b #

Type-classes

class Functor f => Semialign f where Source #

Minimal complete definition

align | alignWith

Methods

align :: f a -> f b -> This f a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> f a -> f b -> This f c d Source #

alignWith' :: (a -> c) -> (b -> d) -> f a -> f b -> This f c d Source #

Instances

Instances details
Semialign [] Source #
>>> align "abc" "def"
This [('a','d'),('b','e'),('c','f')] Nothing
>>> align "abc" "defghi"
This [('a','d'),('b','e'),('c','f')] Just (Right ('g' :| "hi"))
>>> align "abcdef" "ghi"
This [('a','g'),('b','h'),('c','i')] Just (Left ('d' :| "ef"))
Instance details

Defined in Data.Alignment

Methods

align :: [a] -> [b] -> This [] a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> [a] -> [b] -> This [] c d Source #

alignWith' :: (a -> c) -> (b -> d) -> [a] -> [b] -> This [] c d Source #

Semialign Maybe Source #
>>> align (Just "x") (Just "y")
This (Just ("x","y")) Nothing
>>> align (Just "x") (Nothing :: Maybe String)
This Nothing Just (Left ("x" :| []))
>>> align (Nothing :: Maybe String) (Just "y")
This Nothing Just (Right ("y" :| []))
Instance details

Defined in Data.Alignment

Methods

align :: Maybe a -> Maybe b -> This Maybe a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> Maybe a -> Maybe b -> This Maybe c d Source #

alignWith' :: (a -> c) -> (b -> d) -> Maybe a -> Maybe b -> This Maybe c d Source #

Semialign ZipList Source # 
Instance details

Defined in Data.Alignment

Methods

align :: ZipList a -> ZipList b -> This ZipList a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> ZipList a -> ZipList b -> This ZipList c d Source #

alignWith' :: (a -> c) -> (b -> d) -> ZipList a -> ZipList b -> This ZipList c d Source #

Semialign Identity Source #
>>> align (Identity "x") (Identity "y")
This (Identity ("x","y")) Nothing
Instance details

Defined in Data.Alignment

Methods

align :: Identity a -> Identity b -> This Identity a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> Identity a -> Identity b -> This Identity c d Source #

alignWith' :: (a -> c) -> (b -> d) -> Identity a -> Identity b -> This Identity c d Source #

Semialign NonEmpty Source #
>>> align ('a':|"bc") ('g':|"hi")
This (('a','g') :| [('b','h'),('c','i')]) Nothing
>>> align ('a':|"bc") ('g':|"hijkl")
This (('a','g') :| [('b','h'),('c','i')]) Just (Right ('j' :| "kl"))
>>> align ('a':|"bcdef") ('g':|"hi")
This (('a','g') :| [('b','h'),('c','i')]) Just (Left ('d' :| "ef"))
Instance details

Defined in Data.Alignment

Methods

align :: NonEmpty a -> NonEmpty b -> This NonEmpty a b Source #

alignWith :: ((a, b) -> (c, d)) -> (a -> c) -> (b -> d) -> NonEmpty a -> NonEmpty b -> This NonEmpty c d Source #

alignWith' :: (a -> c) -> (b -> d) -> NonEmpty a -> NonEmpty b -> This NonEmpty c d Source #

class Semialign f => Align f where Source #

Methods

nil :: f a Source #

Instances

Instances details
Align [] Source # 
Instance details

Defined in Data.Alignment

Methods

nil :: [a] Source #

Align Maybe Source # 
Instance details

Defined in Data.Alignment

Methods

nil :: Maybe a Source #

Align ZipList Source # 
Instance details

Defined in Data.Alignment

Methods

nil :: ZipList a Source #

Optics

these :: Lens (This f a b) (This f' a b) (f (a, b)) (f' (a, b)) Source #

>>> over these reverse (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("def",'y'),("abc",'x')] Nothing
>>> over these reverse (This [("abc", 'x'), ("def", 'y')] (Just (Left ("ghi":|["jkl"]))))
This [("def",'y'),("abc",'x')] Just (Left ("ghi" :| ["jkl"]))

those :: Lens' (This f a b) (Maybe (Either (NonEmpty a) (NonEmpty b))) Source #

>>> over those (fmap (bimap (fmap reverse) (fmap Data.Char.toUpper))) (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'x'),("def",'y')] Nothing
>>> over those (fmap (bimap (fmap reverse) (fmap Data.Char.toUpper))) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'x'),("def",'y')] Just (Left ("cba" :| ["fed"]))
>>> over those (fmap (bimap (fmap reverse) (fmap Data.Char.toUpper))) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('A' :| "BCDE"))
>>> Control.Lens.view those (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.view those (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just (Left ("abc" :| ["def"]))
>>> Control.Lens.view those (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just (Right ('a' :| "bcde"))

allThese :: Traversable f => Traversal' (This f a b) (a, b) Source #

>>> over allThese (bimap reverse Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("cba",'X'),("fed",'Y')] Nothing
>>> over allThese (bimap reverse Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("cba",'X'),("fed",'Y')] Just (Left ("abc" :| ["def"]))
>>> over allThese (bimap reverse Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("cba",'X'),("fed",'Y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allThese (This [("abc", 'x'), ("def", 'y')] Nothing)
Just ("abc",'x')
>>> Control.Lens.preview allThese (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just ("abc",'x')
>>> Control.Lens.preview allThese (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just ("abc",'x')

allThese1 :: Traversable f => Traversal' (This f a b) a Source #

>>> over allThese1 reverse (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("cba",'x'),("fed",'y')] Nothing
>>> over allThese1 reverse (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("cba",'x'),("fed",'y')] Just (Left ("abc" :| ["def"]))
>>> over allThese1 reverse (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("cba",'x'),("fed",'y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allThese1 (This [("abc", 'x'), ("def", 'y')] Nothing)
Just "abc"
>>> Control.Lens.preview allThese1 (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just "abc"
>>> Control.Lens.preview allThese1 (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just "abc"

allThese2 :: Traversable f => Traversal' (This f a b) b Source #

>>> over allThese2 Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'X'),("def",'Y')] Nothing
>>> over allThese2 Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'X'),("def",'Y')] Just (Left ("abc" :| ["def"]))
>>> over allThese2 Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'X'),("def",'Y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allThese2 (This [("abc", 'x'), ("def", 'y')] Nothing)
Just 'x'
>>> Control.Lens.preview allThese2 (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just 'x'
>>> Control.Lens.preview allThese2 (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just 'x'

allThose :: Traversal' (This f a b) (Either (NonEmpty a) (NonEmpty b)) Source #

>>> over allThose (bimap (fmap reverse) (fmap Data.Char.toUpper)) (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'x'),("def",'y')] Nothing
>>> over allThose (bimap (fmap reverse) (fmap Data.Char.toUpper)) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'x'),("def",'y')] Just (Left ("cba" :| ["fed"]))
>>> over allThose (bimap (fmap reverse) (fmap Data.Char.toUpper)) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('A' :| "BCDE"))
>>> Control.Lens.preview allThose (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.preview allThose (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just (Left ("abc" :| ["def"]))
>>> Control.Lens.preview allThose (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just (Right ('a' :| "bcde"))

allThoseA :: Traversal' (This f a b) (NonEmpty a) Source #

>>> over allThoseA (fmap reverse) (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'x'),("def",'y')] Nothing
>>> over allThoseA (fmap reverse) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'x'),("def",'y')] Just (Left ("cba" :| ["fed"]))
>>> over allThoseA (fmap reverse) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allThoseA (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.preview allThoseA (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just ("abc" :| ["def"])
>>> Control.Lens.preview allThoseA (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Nothing

allThoseA' :: Traversable f => Traversal' (This f a b) a Source #

>>> over allThoseA' reverse (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'x'),("def",'y')] Nothing
>>> over allThoseA' reverse (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'x'),("def",'y')] Just (Left ("cba" :| ["fed"]))
>>> over allThoseA' reverse (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allThoseA' (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.preview allThoseA' (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just "abc"
>>> Control.Lens.preview allThoseA' (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Nothing

allThoseAOr :: Traversal' (This f a b) [a] Source #

>>> 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"

allThoseB :: Traversal' (This f a b) (NonEmpty b) Source #

>>> 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"]))))
This [("abc",'x'),("def",'y')] Just (Left ("abc" :| ["def"]))
>>> over allThoseB (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('A' :| "BCDE"))
>>> Control.Lens.preview allThoseB (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.preview allThoseB (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Nothing
>>> Control.Lens.preview allThoseB (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just ('a' :| "bcde")

allThoseB' :: Traversable f => Traversal' (This f a b) b Source #

>>> over allThoseB' Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'x'),("def",'y')] Nothing
>>> over allThoseB' Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'x'),("def",'y')] Just (Left ("abc" :| ["def"]))
>>> over allThoseB' Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'x'),("def",'y')] Just (Right ('A' :| "BCDE"))
>>> Control.Lens.preview allThoseB' (This [("abc", 'x'), ("def", 'y')] Nothing)
Nothing
>>> Control.Lens.preview allThoseB' (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Nothing
>>> Control.Lens.preview allThoseB' (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just 'a'

allThoseBOr :: Traversal' (This f a b) [b] Source #

>>> 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"

allTheseThoseA :: Traversable f => Traversal' (This f a b) a Source #

>>> over allTheseThoseA (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("ABC",'x'),("DEF",'y')] Nothing
>>> over allTheseThoseA (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("ABC",'x'),("DEF",'y')] Just (Left ("ABC" :| ["DEF"]))
>>> over allTheseThoseA (fmap Data.Char.toUpper) (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("ABC",'x'),("DEF",'y')] Just (Right ('a' :| "bcde"))
>>> Control.Lens.preview allTheseThoseA (This [("abc", 'x'), ("def", 'y')] Nothing)
Just "abc"
>>> Control.Lens.preview allTheseThoseA (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just "abc"
>>> Control.Lens.preview allTheseThoseA (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just "abc"

allTheseThoseB :: Traversable f => Traversal' (This f a b) b Source #

>>> over allTheseThoseB Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] Nothing)
This [("abc",'X'),("def",'Y')] Nothing
>>> over allTheseThoseB Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
This [("abc",'X'),("def",'Y')] Just (Left ("abc" :| ["def"]))
>>> over allTheseThoseB Data.Char.toUpper (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
This [("abc",'X'),("def",'Y')] Just (Right ('A' :| "BCDE"))
>>> Control.Lens.preview allTheseThoseB (This [("abc", 'x'), ("def", 'y')] Nothing)
Just 'x'
>>> Control.Lens.preview allTheseThoseB (This [("abc", 'x'), ("def", 'y')] (Just (Left ("abc":|["def"]))))
Just 'x'
>>> Control.Lens.preview allTheseThoseB (This [("abc", 'x'), ("def", 'y')] (Just (Right ('a':|"bcde"))))
Just 'x'