Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data This f a b = This (f (a, b)) (Maybe (Either (NonEmpty a) (NonEmpty b)))
- class Functor f => Semialign f where
- class Semialign f => Align f where
- nil :: f a
- these :: Lens (This f a b) (This f' a b) (f (a, b)) (f' (a, b))
- those :: Lens' (This f a b) (Maybe (Either (NonEmpty a) (NonEmpty b)))
- allThese :: Traversable f => Traversal' (This f a b) (a, b)
- allThese1 :: Traversable f => Traversal' (This f a b) a
- allThese2 :: Traversable f => Traversal' (This f a b) b
- allThose :: Traversal' (This f a b) (Either (NonEmpty a) (NonEmpty b))
- allThoseA :: Traversal' (This f a b) (NonEmpty a)
- allThoseA' :: Traversable f => Traversal' (This f a b) a
- allThoseAOr :: Traversal' (This f a b) [a]
- allThoseB :: Traversal' (This f a b) (NonEmpty b)
- allThoseB' :: Traversable f => Traversal' (This f a b) b
- allThoseBOr :: Traversal' (This f a b) [b]
- allTheseThoseA :: Traversable f => Traversal' (This f a b) a
- allTheseThoseB :: Traversable f => Traversal' (This f a b) b
Types
Instances
Functor f => Bifunctor (This f) Source # | |
Functor f => Swap (This f) Source # |
|
Defined in Data.Alignment | |
Traversable f => Bitraversable (This f) Source # | |
Defined in Data.Alignment bitraverse :: Applicative f0 => (a -> f0 c) -> (b -> f0 d) -> This f a b -> f0 (This f c d) # | |
Foldable f => Bifoldable (This f) Source # | |
Functor f => Functor (This f a) Source # | |
(Monoid a, Applicative f) => Applicative (This f a) Source # | |
(Eq1 f, Eq a) => Eq1 (This f a) Source # | |
(Ord1 f, Ord a) => Ord1 (This f a) Source # | |
Defined in Data.Alignment | |
(Show1 f, Show a) => Show1 (This f a) Source # | |
(Semigroup a, Apply f) => Apply (This f a) Source # |
|
(Eq1 f, Eq a, Eq b) => Eq (This f a b) Source # | |
(Ord1 f, Ord a, Ord b) => Ord (This f a b) Source # | |
(Show1 f, Show a, Show b) => Show (This f a b) Source # | |
Semigroup (This [] a b) Source # |
|
Semigroup (This NonEmpty a b) Source # | |
Monoid (This [] a b) Source # | |
Type-classes
class Functor f => Semialign f where Source #
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
Semialign [] Source # |
|
Semialign Maybe Source # |
|
Semialign ZipList Source # | |
Semialign Identity Source # |
|
Semialign NonEmpty 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'