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

ModuleBNFC-2.9.5Haskell2010

BNFC.Backend.Haskell.CFtoPrinter

  • 2 values
  • PackageBNFC-2.9.5
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCFtoPrinter.hs
valuecf2Printer
  1. :: TokenText

    Are identifiers ByteStrings or Text rather than Strings? (Option --bytestrings and --text)

  2. -> Bool

    Option --functor?

  3. -> Bool

    --haskell-gadt?

  4. -> String

    Name of created Haskell module.

  5. -> AbsMod

    Name of Haskell module for abstract syntax.

  6. -> CF

    Grammar.

  7. -> Doc
#

Derive pretty-printer from a BNF grammar.

valuecompareRules :: IsFun f => Rul f -> Rul f -> Ordering
#

Define an ordering on lists' rules with the following properties:

  • rules with a higher coercion level should come first, i.e. the rules for [Foo3] are before rules for [Foo1] and they are both lower than rules for [Foo].

  • [] < [_] < _:_

This is desiged to correctly order the rules in the prt function for lists so that the pattern matching works as expectd.

Example1 expression
compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (CoercCat "Foo" 1)) [] Parsable)LT
Example1 expression
compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (Cat "Foo")) [] Parsable)LT
Example1 expression
compareRules (npRule "[]" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable)LT
Example1 expression
compareRules (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:)" (ListCat (Cat "Foo")) [] Parsable)LT