GenI-0.25.0.1: A natural language generator (specifically, an FB-LTAG surface realiser)

Safe HaskellSafe
LanguageHaskell2010

NLP.GenI.Pretty

Description

This is not a proper pretty printer. I aim is to replace this with a (de-facto) standard library if one should appear

Synopsis

Documentation

class Pretty a where Source #

An alternative Show instance (the idea being that we should reserve Show for outputting actual Haskell)

Minimal implementation is pretty or prettyStr

Methods

pretty :: a -> Text Source #

prettyStr :: a -> String Source #

Instances

Pretty Int Source # 
Pretty Integer Source # 
Pretty String Source # 
Pretty Text Source # 
Pretty PolarityKey Source # 
Pretty GeniVal Source # 
Pretty LexCombineError2 Source # 
Pretty LexCombineError Source # 
Pretty SemInput Source # 
Pretty Sem Source # 
Pretty LexEntry Source # 
Pretty GenStatus Source # 
Pretty RankedOtConstraint Source # 
Pretty OtConstraint Source # 
Pretty GeniError Source # 
Pretty [TagSite] Source # 
Pretty (AvPair GeniVal) Source # 
Pretty (Flist GeniVal) Source # 
Pretty (Literal GeniVal) Source # 
Pretty (GNode GeniVal) Source #

The default show for GNode tries to be very compact; it only shows the value for cat attribute and any flags which are marked on that node.

This is one the places where the pretty representation of a GenI object is different from its GenI-format one

GeniShow sem => Pretty (TestCase sem) Source # 

(<>) :: Monoid m => m -> m -> m infixr 6 #

An infix synonym for mappend.

Since: 4.5.0.0

(<+>) :: Text -> Text -> Text Source #

Separated by space unless one of them is empty (in which case just the non-empty one)

above :: Text -> Text -> Text Source #

I think I want ($+$) here but I'm not sure I understand the documentation from the pretty package.

t1 above t2 separates the two by a newline, unless one of them is empty. The vertical equivalent to '(+)'

between :: Text -> Text -> Text -> Text Source #

between l r t == l <> t <> r

parens :: Text -> Text Source #

parens t puts t between parentheses (())

squares :: Text -> Text Source #

squares t puts t between square brackets ([])

squeezed :: Int -> [Text] -> Text Source #

Puts list items on the same line if they are smaller than a certain width otherwise, puts a newline in between them

prettyCount :: (a -> Text) -> Text -> (a, Int) -> Text Source #

prettyCount toBlah ""     (x,1) == "blah"
prettyCount toBlah "foos" (x,1) == "blah"
prettyCount toBlah ""     (x,4) == "blah ×4"
prettyCount toBlah "foos" (x,4) == "blah ×4 foos"