TmOracle

ghc-8.6.4.20190406: The GHC API

Safe Haskell | None
Language | Haskell2010

TmOracle

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)
- type PmVarEnv = NameEnv PmExpr
- falsePmExpr :: PmExpr
- eqPmLit :: PmLit -> PmLit -> Bool
- filterComplex :: [ComplexEq] -> [PmNegLitCt]
- isNotPmExprOther :: PmExpr -> Bool
- runPmPprM :: PmPprM a -> [PmNegLitCt] -> (a, [(SDoc, [PmLit])])
- lhsExprToPmExpr :: LHsExpr GhcTc -> PmExpr
- hsExprToPmExpr :: HsExpr GhcTc -> PmExpr
- pprPmExprWithParens :: PmExpr -> PmPprM SDoc
- tmOracle :: TmState -> [ComplexEq] -> Maybe TmState
- type TmState = ([ComplexEq], TmOracleEnv)
- initialTmState :: TmState
- solveOneEq :: TmState -> ComplexEq -> Maybe TmState
- extendSubst :: Id -> PmExpr -> TmState -> TmState
- canDiverge :: Name -> TmState -> Bool
- toComplex :: SimpleEq -> ComplexEq
- exprDeepLookup :: PmVarEnv -> PmExpr -> PmExpr
- pmLitType :: PmLit -> Type
- flattenPmVarEnv :: PmVarEnv -> PmVarEnv

# 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

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

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 #

type PmVarEnv = NameEnv PmExpr Source #

The type of substitutions.

falsePmExpr :: PmExpr Source #

Expression `False`

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

Equality between literals for pattern match checking.

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

isNotPmExprOther :: PmExpr -> Bool Source #

Check if an expression is lifted or not

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

lhsExprToPmExpr :: LHsExpr GhcTc -> PmExpr Source #

hsExprToPmExpr :: HsExpr GhcTc -> PmExpr Source #

pprPmExprWithParens :: PmExpr -> PmPprM SDoc Source #

tmOracle :: TmState -> [ComplexEq] -> Maybe TmState Source #

External interface to the term oracle.

type TmState = ([ComplexEq], TmOracleEnv) Source #

The state of the term oracle (includes complex constraints that cannot progress unless we get more information).

initialTmState :: TmState Source #

Initial state of the oracle.

solveOneEq :: TmState -> ComplexEq -> Maybe TmState Source #

Solve a complex equality (top-level).

extendSubst :: Id -> PmExpr -> TmState -> TmState Source #

When we know that a variable is fresh, we do not actually have to check whether anything changes, we know that nothing does. Hence, `extendSubst` simply extends the substitution, unlike what `extendSubstAndSolve` does.

canDiverge :: Name -> TmState -> Bool Source #

Check whether a constraint (x ~ BOT) can succeed, given the resulting state of the term oracle.

toComplex :: SimpleEq -> ComplexEq Source #

Lift a `SimpleEq` to a `ComplexEq`

exprDeepLookup :: PmVarEnv -> PmExpr -> PmExpr Source #

Apply an (un-flattened) substitution to an expression.

pmLitType :: PmLit -> Type Source #

Type of a PmLit

flattenPmVarEnv :: PmVarEnv -> PmVarEnv Source #

Flatten the DAG (Could be improved in terms of performance.).