Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module helps handle operator chains composed of different operators that may have different precedence and fixities.
Synopsis
- data OpTree ty op
- = OpNode ty
- | OpBranches [OpTree ty op] [op]
- data OpInfo op = OpInfo {}
- opTreeLoc :: HasSrcSpan l => OpTree (GenLocated l a) b -> SrcSpan
- reassociateOpTree :: (op -> Maybe RdrName) -> FixityMap -> LazyFixityMap -> OpTree ty op -> OpTree ty (OpInfo op)
- isHardSplitterOp :: FixityInfo -> Bool
Documentation
Intermediate representation of operator trees, where a branching is not just a binary branching (with a left node, right node, and operator like in the GHC's AST), but rather a n-ary branching, with n + 1 nodes and n operators (n >= 1).
This representation allows us to put all the operators with the same precedence level as direct siblings in this tree, to better represent the idea of a chain of operators.
OpNode ty | A node which is not an operator application |
OpBranches [OpTree ty op] [op] | A subtree of operator application(s); the invariant is: |
Wrapper for an operator, carrying information about its name and fixity.
OpInfo | |
|
opTreeLoc :: HasSrcSpan l => OpTree (GenLocated l a) b -> SrcSpan Source #
isHardSplitterOp :: FixityInfo -> Bool Source #