ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

PmExpr

Synopsis

- data PmExpr
  - = PmExprVar Name
  - | PmExprCon ConLike [PmExpr]
  - | PmExprLit PmLit
  - | PmExprEq PmExpr PmExpr
  - | PmExprOther (HsExpr Id)
- data PmLit
  - = PmSLit HsLit
  - | PmOLit Bool (HsOverLit Id)
- type SimpleEq = (Id, PmExpr)
- type ComplexEq = (PmExpr, PmExpr)
- toComplex :: SimpleEq -> ComplexEq
- eqPmLit :: PmLit -> PmLit -> Bool
- truePmExpr :: PmExpr
- falsePmExpr :: PmExpr
- isTruePmExpr :: PmExpr -> Bool
- isFalsePmExpr :: PmExpr -> Bool
- isNotPmExprOther :: PmExpr -> Bool
- lhsExprToPmExpr :: LHsExpr Id -> PmExpr
- hsExprToPmExpr :: HsExpr Id -> PmExpr
- substComplexEq :: Name -> PmExpr -> ComplexEq -> Either ComplexEq ComplexEq
- filterComplex :: [ComplexEq] -> [PmNegLitCt]
- pprPmExprWithParens :: PmExpr -> PmPprM SDoc
- runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc, [PmLit])])

# Documentation

data PmExpr #

Lifted expressions for pattern match checking.

Constructors

PmExprVar Name |
PmExprCon ConLike [PmExpr] |
PmExprLit PmLit |
PmExprEq PmExpr PmExpr |
PmExprOther (HsExpr Id) |

Instances

Outputable PmExpr # |
Methods ppr :: PmExpr -> SDoc # pprPrec :: Rational -> PmExpr -> SDoc #

data PmLit #

Literals (simple and overloaded ones) for pattern match checking.

Constructors

PmSLit HsLit |
PmOLit Bool (HsOverLit Id) |

Instances

Outputable PmLit # |
Methods ppr :: PmLit -> SDoc # pprPrec :: Rational -> PmLit -> SDoc #

type SimpleEq = (Id, PmExpr) #

Term equalities

type ComplexEq = (PmExpr, PmExpr) #

toComplex :: SimpleEq -> ComplexEq #

Lift a `SimpleEq` to a `ComplexEq`

eqPmLit :: PmLit -> PmLit -> Bool #

Equality between literals for pattern match checking.

truePmExpr :: PmExpr #

Expression `True`

falsePmExpr :: PmExpr #

Expression `False`

isTruePmExpr :: PmExpr -> Bool #

Check whether a PmExpr is syntactically equal to term `True`.

isFalsePmExpr :: PmExpr -> Bool #

Check whether a PmExpr is syntactically equal to term `False`.

isNotPmExprOther :: PmExpr -> Bool #

Check if an expression is lifted or not

lhsExprToPmExpr :: LHsExpr Id -> PmExpr #

hsExprToPmExpr :: HsExpr Id -> PmExpr #

substComplexEq :: Name -> PmExpr -> ComplexEq -> Either ComplexEq ComplexEq #

Substitute in a complex equality. We return (Left eq) if the substitution affected the equality or (Right eq) if nothing happened.

filterComplex :: [ComplexEq] -> [PmNegLitCt] #

pprPmExprWithParens :: PmExpr -> PmPprM SDoc #

runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc, [PmLit])]) #