Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A module to represent text with very basic formatting. Values are of
type [Text
] and shown with showText
.
As an example of the formatting:
[Line "Cooking for hungry people." ,Line "Welcome to my cookery recipe program, I sure hope you enjoy using it!" ,Line "" ,Cols ["Omlette"," A tasty eggy treat."] ,Cols [" -m"," --mushrooms"," Some mushrooms, or in fact any other ingredients you have in the cupboards"] ,Cols [" -e"," --eggs", " But always you need eggs"] ,Line "" ,Cols ["Spagetti Bolognaise", " An Italian delight."] ,Cols [" -s"," --spagetti"," The first word in the name"] ,Cols [" -b"," --bolognaise"," The second word in the name"] ,Cols [" -d"," --dolmio"," The magic ingredient!"] ,Line "" ,Line " The author of this program explicitly disclaims any liability for poisoning people who get their recipes off the internet."]
With putStrLn (
gives:showText
(Wrap
50) demo)
Cooking for hungry people. Welcome to my cookery recipe program, I sure hope you enjoy using it! Omlette A tasty eggy treat. -m --mushrooms Some mushrooms, or in fact any other ingredients you have in the cupboards -e --eggs But always you need eggs Spagetti Bolognaise An Italian delight. -s --spagetti The first word in the name -b --bolognaise The second word in the name -d --dolmio The magic ingredient! The author of this program explicitly disclaims any liability for poisoning people who get their recipes off the internet.
Synopsis
- data TextFormat
- defaultWrap :: TextFormat
- data Text
- showText :: TextFormat -> [Text] -> String
Documentation
data TextFormat Source #
How to output the text.
HTML | Display as HTML. |
Wrap Int | Display as text wrapped at a certain width (see |
Instances
Read TextFormat Source # | |
Defined in System.Console.CmdArgs.Text readsPrec :: Int -> ReadS TextFormat # readList :: ReadS [TextFormat] # readPrec :: ReadPrec TextFormat # readListPrec :: ReadPrec [TextFormat] # | |
Show TextFormat Source # | |
Defined in System.Console.CmdArgs.Text showsPrec :: Int -> TextFormat -> ShowS # show :: TextFormat -> String # showList :: [TextFormat] -> ShowS # | |
Default TextFormat Source # | |
Defined in System.Console.CmdArgs.Text def :: TextFormat Source # | |
Eq TextFormat Source # | |
Defined in System.Console.CmdArgs.Text (==) :: TextFormat -> TextFormat -> Bool # (/=) :: TextFormat -> TextFormat -> Bool # | |
Ord TextFormat Source # | |
Defined in System.Console.CmdArgs.Text compare :: TextFormat -> TextFormat -> Ordering # (<) :: TextFormat -> TextFormat -> Bool # (<=) :: TextFormat -> TextFormat -> Bool # (>) :: TextFormat -> TextFormat -> Bool # (>=) :: TextFormat -> TextFormat -> Bool # max :: TextFormat -> TextFormat -> TextFormat # min :: TextFormat -> TextFormat -> TextFormat # |
defaultWrap :: TextFormat Source #
Wrap with the default width of 80 characters.
The data type representing some text, typically used as [Text]
. The formatting
is described by:
Line
values represent a paragraph of text, and may be wrapped depending on theTextFormat
. If aLine
value is wrapped then all leading space will be treated as an indent.Cols
values represent columns of text. Within any[Text]
all columns of the same length are grouped in tabs, with the final column being wrapped if necessary. All columns are placed adjacent with no space between them - for this reason most columns will start with a space.