@@ 1,7 1,11 @@
-module Data.Text.ParagraphLayout.Internal.WithSpan (WithSpan (WithSpan))
+module Data.Text.ParagraphLayout.Internal.WithSpan
+ ( WithSpan (WithSpan)
+ , allBoxes
+ )
where
import Data.Text.ParagraphLayout.Internal.BiDiReorder
+import Data.Text.ParagraphLayout.Internal.ResolvedBox
import Data.Text.ParagraphLayout.Internal.ResolvedSpan
import Data.Text.ParagraphLayout.Internal.TextContainer
@@ 22,3 26,9 @@ instance SeparableTextContainer a => SeparableTextContainer (WithSpan d a) where
instance WithLevel a => WithLevel (WithSpan d a) where
level (WithSpan _ x) = level x
+
+boxes :: WithSpan d a -> [ResolvedBox d]
+boxes (WithSpan s _) = spanBoxes s
+
+allBoxes :: (Foldable f, Functor f) => f (WithSpan d a) -> [ResolvedBox d]
+allBoxes xs = foldr union [] $ fmap boxes xs