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

Safe HaskellSafe-Infered



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



class Pretty a whereSource

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

Minimal implementation is pretty or prettyStr


pretty :: a -> TextSource

prettyStr :: a -> StringSource


Pretty Int 
Pretty Integer 
Pretty String 
Pretty PolarityKey 
Pretty GeniVal 
Pretty SemInput 
Pretty Sem 
Pretty TestCase 
Pretty LexCombineError2 
Pretty LexCombineError 
Pretty LexEntry 
Pretty RankedOtConstraint 
Pretty OtConstraint 
Pretty GeniError 
Pretty [TagSite] 
Pretty (FeatStruct GeniVal) 
Pretty (AvPair GeniVal) 
Pretty (Flist GeniVal) 
Pretty (Literal GeniVal) 
Pretty (GNode GeniVal)

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

(<>) :: Text -> Text -> TextSource

Identical to append

(<+>) :: Text -> Text -> TextSource

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

above :: Text -> Text -> TextSource

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 '(+)'

prettyCount :: (a -> Text) -> Text -> (a, Int) -> TextSource

 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"