| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Fmt.String
Description
Synopsis
- newtype Builder = Builder {}
- type StringFmt = Fmt Builder
- runStringFmt :: StringFmt String a -> a
- printf :: StringFmt (IO ()) a -> a
- cat1With :: Foldable f => ([String] -> String) -> Fmt1 Builder String a -> Fmt1 Builder s (f a)
- hsep :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a)
- vsep :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a)
- hang :: Foldable f => Int -> Fmt1 Builder String a -> Fmt1 Builder s (f a)
- list1 :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a)
- replace1 :: String -> Fmt Builder a a -> Fmt Builder a b -> Fmt Builder a b
- splitWith :: (String -> (String, String)) -> (String -> String -> Fmt Builder a2 a1) -> Fmt Builder a1 b -> Fmt Builder a2 b
- run1 :: Fmt1 Builder String a -> a -> String
- jsonList :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a)
- yamlList :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a)
- jsonMap :: Foldable f => Fmt1 Builder String k -> Fmt1 Builder String v -> Fmt1 Builder s (f (k, v))
- yamlMap :: Foldable f => Fmt1 Builder String k -> Fmt1 Builder String v -> Fmt1 Builder s (f (k, v))
Builder
A ShowS-backed string builder with O(1) concatenation.
StringFmt
Combinators
cat1With :: Foldable f => ([String] -> String) -> Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format each value in a foldable and join the results.
hsep :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format each value with spaces in between.
vsep :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format each value on its own line.
hang :: Foldable f => Int -> Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format each value on its own line, indented by n spaces.
list1 :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format in square brackets with comma separation.
Splitting
replace1 :: String -> Fmt Builder a a -> Fmt Builder a b -> Fmt Builder a b Source #
Replace the first occurrence of a search term.
splitWith :: (String -> (String, String)) -> (String -> String -> 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 String a -> Fmt1 Builder s (f a) Source #
Format a foldable as a JSON-style list.
yamlList :: Foldable f => Fmt1 Builder String a -> Fmt1 Builder s (f a) Source #
Format a foldable as a YAML-style list.