summaryrefslogtreecommitdiff
path: root/src/Erebos/TextFormat.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-01-31 17:48:55 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-01-31 20:42:22 +0100
commit0c36f490719f613dc23b6632a4098bd17fb0ab7c (patch)
tree895014981fe22b57b73fe63aba6918520341e5aa /src/Erebos/TextFormat.hs
parent0c1f276f3bfc2f25653d1cd7a75b59d9f6afd522 (diff)
Data structure for formatted text
Diffstat (limited to 'src/Erebos/TextFormat.hs')
-rw-r--r--src/Erebos/TextFormat.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Erebos/TextFormat.hs b/src/Erebos/TextFormat.hs
new file mode 100644
index 0000000..0bfad75
--- /dev/null
+++ b/src/Erebos/TextFormat.hs
@@ -0,0 +1,16 @@
+module Erebos.TextFormat (
+ FormattedText,
+
+ renderPlainText,
+) where
+
+import Data.Text (Text)
+
+import Erebos.TextFormat.Types
+
+
+renderPlainText :: FormattedText -> Text
+renderPlainText = \case
+ PlainText text -> text
+ ConcatenatedText ftexts -> mconcat $ map renderPlainText ftexts
+ FormattedText _ ftext -> renderPlainText ftext