| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Fmt.Text
Description
Text formatting via Builder.
Synopsis
- type TextFmt = Fmt Builder
- runTextFmt :: TextFmt Text a -> a
- printf :: TextFmt (IO ()) a -> a
- cat1With :: Foldable f => ([Text] -> Text) -> Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- hsep :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- vsep :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- hang :: Foldable f => Int -> Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- list1 :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- replace1 :: Text -> Fmt Builder a a -> Fmt Builder a b -> Fmt Builder a b
- splitWith :: (Text -> (Text, Text)) -> (Text -> Text -> Fmt Builder a2 a1) -> Fmt Builder a1 b -> Fmt Builder a2 b
- run1 :: Fmt1 Builder Text a -> a -> Text
- jsonList :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- yamlList :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a)
- jsonMap :: Foldable f => Fmt1 Builder Text k -> Fmt1 Builder Text v -> Fmt1 Builder s (f (k, v))
- yamlMap :: Foldable f => Fmt1 Builder Text k -> Fmt1 Builder Text v -> Fmt1 Builder s (f (k, v))
TextFmt
Combinators
cat1With :: Foldable f => ([Text] -> Text) -> Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format each value in a foldable and join the results.
hsep :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format each value with spaces in between.
vsep :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format each value on its own line.
hang :: Foldable f => Int -> Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format each value on its own line, indented by n spaces.
list1 :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format in square brackets with comma separation.
Splitting
replace1 :: Text -> Fmt Builder a a -> Fmt Builder a b -> Fmt Builder a b Source #
Replace the first occurrence of a search term.
splitWith :: (Text -> (Text, Text)) -> (Text -> Text -> Fmt Builder a2 a1) -> Fmt Builder a1 b -> Fmt Builder a2 b Source #
Split the formatted output using a splitting function, then rejoin with a custom combinator.
Running Fmt1
Structured output
jsonList :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format a foldable as a JSON-style list.
yamlList :: Foldable f => Fmt1 Builder Text a -> Fmt1 Builder s (f a) Source #
Format a foldable as a YAML-style list.