PmExpr

ghc-8.8.0.20190721: The GHC API

Safe Haskell | None
Language | Haskell2010

PmExpr

Synopsis

- data PmExpr
  - = PmExprVar Name
  - | PmExprCon ConLike [PmExpr]
  - | PmExprLit PmLit
  - | PmExprEq PmExpr PmExpr
  - | PmExprOther (HsExpr GhcTc)
- data PmLit
  - = PmSLit (HsLit GhcTc)
  - | PmOLit Bool (HsOverLit GhcTc)
- 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 GhcTc -> PmExpr
- hsExprToPmExpr :: HsExpr GhcTc -> 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 Source #

Lifted expressions for pattern match checking.

Constructors

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

#### Instances

Instances details

Outputable PmExpr # |
Instance details Defined in PmExpr Methods ppr :: PmExpr -> SDoc Source # pprPrec :: Rational -> PmExpr -> SDoc Source #

data PmLit Source #

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

Constructors

PmSLit (HsLit GhcTc) |
PmOLit Bool (HsOverLit GhcTc) |

#### Instances

Instances details

Outputable PmLit # |
Instance details Defined in PmExpr Methods ppr :: PmLit -> SDoc Source # pprPrec :: Rational -> PmLit -> SDoc Source #

type SimpleEq = (Id, PmExpr) Source #

Term equalities

type ComplexEq = (PmExpr, PmExpr) Source #

toComplex :: SimpleEq -> ComplexEq Source #

Lift a `SimpleEq` to a `ComplexEq`

eqPmLit :: PmLit -> PmLit -> Bool Source #

Equality between literals for pattern match checking.

truePmExpr :: PmExpr Source #

Expression `True`

falsePmExpr :: PmExpr Source #

Expression `False`

isTruePmExpr :: PmExpr -> Bool Source #

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

isFalsePmExpr :: PmExpr -> Bool Source #

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

isNotPmExprOther :: PmExpr -> Bool Source #

Check if an expression is lifted or not

lhsExprToPmExpr :: LHsExpr GhcTc -> PmExpr Source #

hsExprToPmExpr :: HsExpr GhcTc -> PmExpr Source #

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

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

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

pprPmExprWithParens :: PmExpr -> PmPprM SDoc Source #

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