CheatSheet - haskell-tools/haskell-tools GitHub Wiki

References

  • References from AST: accessing child nodes of unannotated AST elements

Generics

  • biplateRef: Accesses all elements that are contained in an element.
  • nodesContained: Accesses all elements that are inside a given source range.
  • nodesContaining: Accesses all elements that contain the given source range.

Analyze and create AST

  • semantics*: Getters for different semantic information. For example semanticsFixity gets the fixity of a name if it is present.
  • mk*: Generator functions for AST elements. They generate AST parst that have default formatting. They take annotated child elements and create an annotataed parent element.

Working with children that have multiplicity

  • filterList: Removes child elements that doesn't satisfy the given condition.
  • replaceList: Replaces the child elements and uses the most common separator for the new elements.
  • insertWhere: Inserts an element into the list of AST child elements. Controlled by two conditions, one for the preceding one for the succeding element. Inserts when both met.

Operations in the LocalRefactoring context

  • referenceName: Creates a name AST node and imports its definition if necessary.
  • referenceOperator: Creates an operator AST node and imports its definition if necessary.

Validation

  • nameValid: Check if a given name is syntactically valid for a type of definition.
  • validModuleName: Check if a given name is syntactically valid for a module.

this page with types