HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecmdargs-0.10.22Haskell2010

System.Console.CmdArgs.Text

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 (showText (Wrap 50) demo) gives:

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.
  • 2 types
  • 2 values
  • Packagecmdargs-0.10.22
  • Exports4
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceText.hs
datadata TextFormat
#

How to output the text.

Constructors

Instances5Eq, Ord, Read, Show, Default
  • Eq TextFormatDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text
  • Ord TextFormatDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text
  • Read TextFormatDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text
  • Show TextFormatDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text
  • Default TextFormatDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text
datadata Text
#

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 the TextFormat. If a Line 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.

Constructors

Instances1Show
  • Show TextDefined in cmdargs-0.10.22 · System.Console.CmdArgs.Text