~jaro/balkon

f816c9028c678035b61c929c84b048067c2da027 — Jaro 1 year, 6 months ago 01cd9cc
Allow extracting ResolvedBox from WithSpan.
1 files changed, 11 insertions(+), 1 deletions(-)

M src/Data/Text/ParagraphLayout/Internal/WithSpan.hs
M src/Data/Text/ParagraphLayout/Internal/WithSpan.hs => src/Data/Text/ParagraphLayout/Internal/WithSpan.hs +11 -1
@@ 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