module ProAbstract.Tagless.CanBeTagless
    ( CanBeTagless (..)
    ) where

import ProAbstract.Content
import ProAbstract.Tagless.KindOfText
import ProAbstract.Structure

class CanBeTagless a where
    tagless :: KindOfText txt -> AffineFold a txt

instance CanBeTagless (Fragment ann) where
    tagless :: KindOfText txt -> AffineFold (Fragment ann) txt
tagless = AffineFold (Fragment ann) Text
-> KindOfText txt -> AffineFold (Fragment ann) txt
forall a txt.
AffineFold a Text -> KindOfText txt -> AffineFold a txt
liftLine (AffineFold (Fragment ann) Text
 -> KindOfText txt -> AffineFold (Fragment ann) txt)
-> AffineFold (Fragment ann) Text
-> KindOfText txt
-> AffineFold (Fragment ann) txt
forall a b. (a -> b) -> a -> b
$ Optic A_Lens NoIx (Fragment ann) (Fragment ann) Text Text
-> AffineFold (Fragment ann) Text
forall destKind srcKind (is :: IxList) s t a b.
Is srcKind destKind =>
Optic srcKind is s t a b -> Optic destKind is s t a b
castOptic Optic A_Lens NoIx (Fragment ann) (Fragment ann) Text Text
forall x x'. HasContent x x' => Lens x x' (Content x) (Content x')
content

instance CanBeTagless (Line ann) where
    tagless :: KindOfText txt -> AffineFold (Line ann) txt
tagless = AffineFold (Line ann) Text
-> KindOfText txt -> AffineFold (Line ann) txt
forall a txt.
AffineFold a Text -> KindOfText txt -> AffineFold a txt
liftLine (AffineFold (Line ann) Text
 -> KindOfText txt -> AffineFold (Line ann) txt)
-> AffineFold (Line ann) Text
-> KindOfText txt
-> AffineFold (Line ann) txt
forall a b. (a -> b) -> a -> b
$ Optic
  A_Lens
  NoIx
  (Line ann)
  (Line ann)
  (Seq (Inline ann))
  (Seq (Inline ann))
forall x x'.
HasContents x x' =>
Lens x x' (Seq (Contents x)) (Seq (Contents x'))
contents Optic
  A_Lens
  NoIx
  (Line ann)
  (Line ann)
  (Seq (Inline ann))
  (Seq (Inline ann))
-> Optic
     An_AffineFold
     NoIx
     (Seq (Inline ann))
     (Seq (Inline ann))
     (Seq Text)
     (Seq Text)
-> Optic
     An_AffineFold NoIx (Line ann) (Line ann) (Seq Text) (Seq Text)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% AffineFold (Inline ann) Text
-> Optic
     An_AffineFold
     NoIx
     (Seq (Inline ann))
     (Seq (Inline ann))
     (Seq Text)
     (Seq Text)
forall (t :: * -> *) a b.
Traversable t =>
AffineFold a b -> AffineFold (t a) (t b)
all (KindOfText Text -> AffineFold (Inline ann) Text
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText Text
TextLine) Optic
  An_AffineFold NoIx (Line ann) (Line ann) (Seq Text) (Seq Text)
-> Optic A_Getter NoIx (Seq Text) (Seq Text) Text Text
-> AffineFold (Line ann) Text
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% (Seq Text -> Text)
-> Optic A_Getter NoIx (Seq Text) (Seq Text) Text Text
forall s a. (s -> a) -> Getter s a
to Seq Text -> Text
forall (t :: * -> *). Foldable t => t Text -> Text
textConcat

instance CanBeTagless (Lines ann) where
    tagless :: KindOfText txt -> AffineFold (Lines ann) txt
tagless = AffineFold (Contents (Lines ann)) Text
-> KindOfText txt -> AffineFold (Lines ann) txt
forall a txt.
HasContents' a =>
AffineFold (Contents a) Text -> KindOfText txt -> AffineFold a txt
linesAre (AffineFold (Contents (Lines ann)) Text
 -> KindOfText txt -> AffineFold (Lines ann) txt)
-> AffineFold (Contents (Lines ann)) Text
-> KindOfText txt
-> AffineFold (Lines ann) txt
forall a b. (a -> b) -> a -> b
$ KindOfText Text -> AffineFold (Line ann) Text
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText Text
TextLine

instance CanBeTagless (PlainBlock ann) where
    tagless :: KindOfText txt -> AffineFold (PlainBlock ann) txt
tagless = AffineFold (Contents (PlainBlock ann)) Text
-> KindOfText txt -> AffineFold (PlainBlock ann) txt
forall a txt.
HasContents' a =>
AffineFold (Contents a) Text -> KindOfText txt -> AffineFold a txt
linesAre (AffineFold (Contents (PlainBlock ann)) Text
 -> KindOfText txt -> AffineFold (PlainBlock ann) txt)
-> AffineFold (Contents (PlainBlock ann)) Text
-> KindOfText txt
-> AffineFold (PlainBlock ann) txt
forall a b. (a -> b) -> a -> b
$ KindOfText Text -> AffineFold (Fragment ann) Text
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText Text
TextLine

instance CanBeTagless (Paragraph ann) where
    tagless :: KindOfText txt -> AffineFold (Paragraph ann) txt
tagless = AffineFold (Contents (Paragraph ann)) Text
-> KindOfText txt -> AffineFold (Paragraph ann) txt
forall a txt.
HasContents' a =>
AffineFold (Contents a) Text -> KindOfText txt -> AffineFold a txt
linesAre (AffineFold (Contents (Paragraph ann)) Text
 -> KindOfText txt -> AffineFold (Paragraph ann) txt)
-> AffineFold (Contents (Paragraph ann)) Text
-> KindOfText txt
-> AffineFold (Paragraph ann) txt
forall a b. (a -> b) -> a -> b
$ KindOfText Text -> AffineFold (Line ann) Text
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText Text
TextLine

-- | Only a 'plain' inline is considered to be plain text, because 'fork' inlines have a tags.
instance CanBeTagless (Inline ann) where
    tagless :: KindOfText txt -> AffineFold (Inline ann) txt
tagless KindOfText txt
s = Optic
  A_Prism
  NoIx
  (Inline ann)
  (Inline ann)
  (Fragment ann)
  (Fragment ann)
forall x. CanBePlain x => Prism' x (Plain x)
plain Optic
  A_Prism
  NoIx
  (Inline ann)
  (Inline ann)
  (Fragment ann)
  (Fragment ann)
-> Optic An_AffineFold NoIx (Fragment ann) (Fragment ann) txt txt
-> AffineFold (Inline ann) txt
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% KindOfText txt
-> Optic An_AffineFold NoIx (Fragment ann) (Fragment ann) txt txt
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText txt
s

-- | Only a 'bare' block is considered to be plain text, because 'fork' and 'plain' blocks have tags.
instance CanBeTagless (Block ann) where
    tagless :: KindOfText txt -> AffineFold (Block ann) txt
tagless KindOfText txt
s = Optic
  A_Prism
  NoIx
  (Block ann)
  (Block ann)
  (Paragraph ann)
  (Paragraph ann)
forall a. IsTaggedOrBare a => Prism' a (BareType a)
bare Optic
  A_Prism
  NoIx
  (Block ann)
  (Block ann)
  (Paragraph ann)
  (Paragraph ann)
-> Optic An_AffineFold NoIx (Paragraph ann) (Paragraph ann) txt txt
-> AffineFold (Block ann) txt
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% KindOfText txt
-> Optic An_AffineFold NoIx (Paragraph ann) (Paragraph ann) txt txt
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText txt
s

instance CanBeTagless (Blocks ann) where
    tagless :: KindOfText txt -> AffineFold (Blocks ann) txt
tagless = \case
        KindOfText txt
TextParagraphs -> Optic
  A_Lens
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Seq (Block ann))
  (Seq (Block ann))
forall x x'.
HasContents x x' =>
Lens x x' (Seq (Contents x)) (Seq (Contents x'))
contents Optic
  A_Lens
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Seq (Block ann))
  (Seq (Block ann))
-> Optic
     An_AffineFold
     NoIx
     (Seq (Block ann))
     (Seq (Block ann))
     (Seq (Seq (Seq Text)))
     (Seq (Seq (Seq Text)))
-> Optic
     An_AffineFold
     NoIx
     (Blocks ann)
     (Blocks ann)
     (Seq (Seq (Seq Text)))
     (Seq (Seq (Seq Text)))
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% AffineFold (Block ann) (Seq (Seq Text))
-> Optic
     An_AffineFold
     NoIx
     (Seq (Block ann))
     (Seq (Block ann))
     (Seq (Seq (Seq Text)))
     (Seq (Seq (Seq Text)))
forall (t :: * -> *) a b.
Traversable t =>
AffineFold a b -> AffineFold (t a) (t b)
all (KindOfText (Seq (Seq Text))
-> AffineFold (Block ann) (Seq (Seq Text))
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText (Seq (Seq Text))
TextParagraphs) Optic
  An_AffineFold
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Seq (Seq (Seq Text)))
  (Seq (Seq (Seq Text)))
-> Optic
     A_Getter
     NoIx
     (Seq (Seq (Seq Text)))
     (Seq (Seq (Seq Text)))
     (Seq (Seq Text))
     (Seq (Seq Text))
-> Optic
     An_AffineFold
     NoIx
     (Blocks ann)
     (Blocks ann)
     (Seq (Seq Text))
     (Seq (Seq Text))
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% (Seq (Seq (Seq Text)) -> Seq (Seq Text))
-> Optic
     A_Getter
     NoIx
     (Seq (Seq (Seq Text)))
     (Seq (Seq (Seq Text)))
     (Seq (Seq Text))
     (Seq (Seq Text))
forall s a. (s -> a) -> Getter s a
to Seq (Seq (Seq Text)) -> Seq (Seq Text)
forall a. Seq (Seq a) -> Seq a
seqConcat
        KindOfText txt
s -> Optic
  A_Lens
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Seq (Block ann))
  (Seq (Block ann))
forall x x'.
HasContents x x' =>
Lens x x' (Seq (Contents x)) (Seq (Contents x'))
contents
            Optic
  A_Lens
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Seq (Block ann))
  (Seq (Block ann))
-> Optic
     A_Prism
     NoIx
     (Seq (Block ann))
     (Seq (Block ann))
     (Maybe (Block ann))
     (Maybe (Block ann))
-> Optic
     An_AffineTraversal
     NoIx
     (Blocks ann)
     (Blocks ann)
     (Maybe (Block ann))
     (Maybe (Block ann))
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic
  A_Prism
  NoIx
  (Seq (Block ann))
  (Seq (Block ann))
  (Maybe (Block ann))
  (Maybe (Block ann))
forall a. Prism' (Seq a) (Maybe a)
seqAtMostOne -- For lines and stanza return types, there is not allowed to be more than one block
            Optic
  An_AffineTraversal
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Maybe (Block ann))
  (Maybe (Block ann))
-> Optic
     An_AffineFold
     NoIx
     (Maybe (Block ann))
     (Maybe (Block ann))
     (Maybe txt)
     (Maybe txt)
-> Optic
     An_AffineFold
     NoIx
     (Blocks ann)
     (Blocks ann)
     (Maybe txt)
     (Maybe txt)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% AffineFold (Block ann) txt
-> Optic
     An_AffineFold
     NoIx
     (Maybe (Block ann))
     (Maybe (Block ann))
     (Maybe txt)
     (Maybe txt)
forall (t :: * -> *) a b.
Traversable t =>
AffineFold a b -> AffineFold (t a) (t b)
all @Maybe (KindOfText txt -> AffineFold (Block ann) txt
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText txt
s) -- If there is a block, it has to be convertable to the desired text kind
            Optic
  An_AffineFold
  NoIx
  (Blocks ann)
  (Blocks ann)
  (Maybe txt)
  (Maybe txt)
-> Optic A_Getter NoIx (Maybe txt) (Maybe txt) txt txt
-> AffineFold (Blocks ann) txt
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% (Maybe txt -> txt)
-> Optic A_Getter NoIx (Maybe txt) (Maybe txt) txt txt
forall s a. (s -> a) -> Getter s a
to (txt -> Maybe txt -> txt
forall a. a -> Maybe a -> a
fromMaybe (KindOfText txt -> txt
forall txt. KindOfText txt -> txt
noText KindOfText txt
s)) -- If there are no blocks, return an empty line or stanza

instance CanBeTagless (BlockTagContent ann) where
    tagless :: KindOfText txt -> AffineFold (BlockTagContent ann) txt
tagless KindOfText txt
s = (Optic
  A_Prism
  NoIx
  (BlockTagContent ann)
  (BlockTagContent ann)
  (Blocks ann)
  (Blocks ann)
forall x. CanFork x => Prism' x (Fork x)
fork Optic
  A_Prism
  NoIx
  (BlockTagContent ann)
  (BlockTagContent ann)
  (Blocks ann)
  (Blocks ann)
-> Optic An_AffineFold NoIx (Blocks ann) (Blocks ann) txt txt
-> AffineFold (BlockTagContent ann) txt
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% KindOfText txt
-> Optic An_AffineFold NoIx (Blocks ann) (Blocks ann) txt txt
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText txt
s) AffineFold (BlockTagContent ann) txt
-> AffineFold (BlockTagContent ann) txt
-> AffineFold (BlockTagContent ann) txt
forall k l (is :: IxList) s a (js :: IxList).
(Is k An_AffineFold, Is l An_AffineFold) =>
Optic' k is s a -> Optic' l js s a -> AffineFold s a
`afailing` (Optic
  A_Prism
  NoIx
  (BlockTagContent ann)
  (BlockTagContent ann)
  (PlainBlock ann)
  (PlainBlock ann)
forall x. CanBePlain x => Prism' x (Plain x)
plain Optic
  A_Prism
  NoIx
  (BlockTagContent ann)
  (BlockTagContent ann)
  (PlainBlock ann)
  (PlainBlock ann)
-> Optic
     An_AffineFold NoIx (PlainBlock ann) (PlainBlock ann) txt txt
-> AffineFold (BlockTagContent ann) txt
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% KindOfText txt
-> Optic
     An_AffineFold NoIx (PlainBlock ann) (PlainBlock ann) txt txt
forall a txt. CanBeTagless a => KindOfText txt -> AffineFold a txt
tagless KindOfText txt
s)

noText :: KindOfText txt -> txt
noText :: KindOfText txt -> txt
noText = \case{ KindOfText txt
TextLine -> txt
Text
textEmpty; KindOfText txt
TextStanza -> txt
forall a. AsEmpty a => a
Empty; KindOfText txt
TextParagraphs -> txt
forall a. AsEmpty a => a
Empty }

all :: Traversable t => AffineFold a b -> AffineFold (t a) (t b)
all :: AffineFold a b -> AffineFold (t a) (t b)
all = (t a -> Maybe (t b)) -> AffineFold (t a) (t b)
forall s a. (s -> Maybe a) -> AffineFold s a
afolding ((t a -> Maybe (t b)) -> AffineFold (t a) (t b))
-> (AffineFold a b -> t a -> Maybe (t b))
-> AffineFold a b
-> AffineFold (t a) (t b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Maybe b) -> t a -> Maybe (t b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((a -> Maybe b) -> t a -> Maybe (t b))
-> (AffineFold a b -> a -> Maybe b)
-> AffineFold a b
-> t a
-> Maybe (t b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AffineFold a b -> a -> Maybe b
forall k (is :: IxList) s a.
Is k An_AffineFold =>
Optic' k is s a -> s -> Maybe a
preview

liftLine :: AffineFold a Text -> KindOfText txt -> AffineFold a txt
liftLine :: AffineFold a Text -> KindOfText txt -> AffineFold a txt
liftLine AffineFold a Text
o = AffineFold a Text
-> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
forall a txt.
AffineFold a Text
-> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
liftStanza AffineFold a Text
o (AffineFold a Text
o AffineFold a Text
-> Optic A_ReversedPrism NoIx Text Text (Seq Text) (Seq Text)
-> AffineFold a (Seq Text)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic A_Prism NoIx (Seq Text) (Seq Text) Text Text
-> Optic
     (ReversedOptic A_Prism) NoIx Text Text (Seq Text) (Seq Text)
forall k (is :: IxList) s t a b.
(ReversibleOptic k, AcceptsEmptyIndices "re" is) =>
Optic k is s t a b -> Optic (ReversedOptic k) is b a t s
re Optic A_Prism NoIx (Seq Text) (Seq Text) Text Text
forall a. Prism' (Seq a) a
seqSingleton)

liftStanza :: AffineFold a Text -> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
liftStanza :: AffineFold a Text
-> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
liftStanza AffineFold a Text
o1 AffineFold a (Seq Text)
o2 = \case{ KindOfText txt
TextLine -> AffineFold a txt
AffineFold a Text
o1; KindOfText txt
TextStanza -> AffineFold a txt
AffineFold a (Seq Text)
o2; KindOfText txt
TextParagraphs -> AffineFold a (Seq Text)
o2 AffineFold a (Seq Text)
-> Optic
     A_ReversedPrism
     NoIx
     (Seq Text)
     (Seq Text)
     (Seq (Seq Text))
     (Seq (Seq Text))
-> Optic An_AffineFold NoIx a a (Seq (Seq Text)) (Seq (Seq Text))
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic
  A_Prism
  NoIx
  (Seq (Seq Text))
  (Seq (Seq Text))
  (Seq Text)
  (Seq Text)
-> Optic
     (ReversedOptic A_Prism)
     NoIx
     (Seq Text)
     (Seq Text)
     (Seq (Seq Text))
     (Seq (Seq Text))
forall k (is :: IxList) s t a b.
(ReversibleOptic k, AcceptsEmptyIndices "re" is) =>
Optic k is s t a b -> Optic (ReversedOptic k) is b a t s
re Optic
  A_Prism
  NoIx
  (Seq (Seq Text))
  (Seq (Seq Text))
  (Seq Text)
  (Seq Text)
forall a. Prism' (Seq a) a
seqSingleton }

linesAre :: HasContents' a => AffineFold (Contents a) Text -> KindOfText txt -> AffineFold a txt
linesAre :: AffineFold (Contents a) Text -> KindOfText txt -> AffineFold a txt
linesAre AffineFold (Contents a) Text
o = AffineFold a Text
-> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
forall a txt.
AffineFold a Text
-> AffineFold a (Seq Text) -> KindOfText txt -> AffineFold a txt
liftStanza (Lens a a (Seq (Contents a)) (Seq (Contents a))
forall x x'.
HasContents x x' =>
Lens x x' (Seq (Contents x)) (Seq (Contents x'))
contents Lens a a (Seq (Contents a)) (Seq (Contents a))
-> Optic
     A_Prism
     NoIx
     (Seq (Contents a))
     (Seq (Contents a))
     (Maybe (Contents a))
     (Maybe (Contents a))
-> Optic
     An_AffineTraversal
     NoIx
     a
     a
     (Maybe (Contents a))
     (Maybe (Contents a))
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% Optic
  A_Prism
  NoIx
  (Seq (Contents a))
  (Seq (Contents a))
  (Maybe (Contents a))
  (Maybe (Contents a))
forall a. Prism' (Seq a) (Maybe a)
seqAtMostOne Optic
  An_AffineTraversal
  NoIx
  a
  a
  (Maybe (Contents a))
  (Maybe (Contents a))
-> Optic
     An_AffineFold
     NoIx
     (Maybe (Contents a))
     (Maybe (Contents a))
     (Maybe Text)
     (Maybe Text)
-> Optic An_AffineFold NoIx a a (Maybe Text) (Maybe Text)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% AffineFold (Contents a) Text
-> Optic
     An_AffineFold
     NoIx
     (Maybe (Contents a))
     (Maybe (Contents a))
     (Maybe Text)
     (Maybe Text)
forall (t :: * -> *) a b.
Traversable t =>
AffineFold a b -> AffineFold (t a) (t b)
all AffineFold (Contents a) Text
o Optic An_AffineFold NoIx a a (Maybe Text) (Maybe Text)
-> Optic A_Getter NoIx (Maybe Text) (Maybe Text) Text Text
-> AffineFold a Text
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% (Maybe Text -> Text)
-> Optic A_Getter NoIx (Maybe Text) (Maybe Text) Text Text
forall s a. (s -> a) -> Getter s a
to (Text -> Maybe Text -> Text
forall a. a -> Maybe a -> a
fromMaybe Text
textEmpty)) (Lens a a (Seq (Contents a)) (Seq (Contents a))
forall x x'.
HasContents x x' =>
Lens x x' (Seq (Contents x)) (Seq (Contents x'))
contents Lens a a (Seq (Contents a)) (Seq (Contents a))
-> Optic
     An_AffineFold
     NoIx
     (Seq (Contents a))
     (Seq (Contents a))
     (Seq Text)
     (Seq Text)
-> AffineFold a (Seq Text)
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% AffineFold (Contents a) Text
-> Optic
     An_AffineFold
     NoIx
     (Seq (Contents a))
     (Seq (Contents a))
     (Seq Text)
     (Seq Text)
forall (t :: * -> *) a b.
Traversable t =>
AffineFold a b -> AffineFold (t a) (t b)
all AffineFold (Contents a) Text
o)