Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides formatting to an instance of Cell
. For example, in a unix
terminal one could use the following:
>>>
buildCell (formatted "\ESC[31m" "Hello World!" "\ESC[0m") :: String
Hello World!
The text then appears in dull red.
More complex nested formatting can be achieved by using the Monoid
instance.
Documentation
Instances
Foldable Formatted Source # | |
Defined in Text.Layout.Table.Cell.Formatted fold :: Monoid m => Formatted m -> m foldMap :: Monoid m => (a -> m) -> Formatted a -> m foldMap' :: Monoid m => (a -> m) -> Formatted a -> m foldr :: (a -> b -> b) -> b -> Formatted a -> b foldr' :: (a -> b -> b) -> b -> Formatted a -> b foldl :: (b -> a -> b) -> b -> Formatted a -> b foldl' :: (b -> a -> b) -> b -> Formatted a -> b foldr1 :: (a -> a -> a) -> Formatted a -> a foldl1 :: (a -> a -> a) -> Formatted a -> a elem :: Eq a => a -> Formatted a -> Bool maximum :: Ord a => Formatted a -> a minimum :: Ord a => Formatted a -> a | |
Traversable Formatted Source # | |
Defined in Text.Layout.Table.Cell.Formatted | |
Functor Formatted Source # | |
IsString a => IsString (Formatted a) Source # | |
Defined in Text.Layout.Table.Cell.Formatted fromString :: String -> Formatted a | |
Monoid (Formatted a) Source # | |
Semigroup (Formatted a) Source # | |
Show a => Show (Formatted a) Source # | |
Eq a => Eq (Formatted a) Source # | |
Cell a => Cell (Formatted a) Source # | |
Defined in Text.Layout.Table.Cell.Formatted visibleLength :: Formatted a -> Int Source # measureAlignment :: (Char -> Bool) -> Formatted a -> AlignInfo Source # buildCell :: StringBuilder b => Formatted a -> b Source # buildCellView :: StringBuilder b => CellView (Formatted a) -> b Source # |
plain :: a -> Formatted a Source #
Create a value from content that is kept plain without any formatting.
:: String | Prefix text directives for formatting. |
-> Formatted a | The content to be formatted. |
-> String | Suffix text directives for formatting. |
-> Formatted a |
Create a formatted value with formatting directives that are applied to the whole value. The actual formatting has to be done by the backend.
:: (String -> String) | Function to operate on prefix text directives. |
-> (String -> String) | Function to operate on suffix text directives. |
-> Formatted a | The formatted value to operate on. |
-> Formatted a |
Map over the formatting directives of a formatted value.