inspection-testing-0.1: GHC plugin to do inspection esting

Safe HaskellNone



This module implements some of analyses of Core expressions necessary for Test.Inspection. Normally, users of this pacakge can ignore this module.



slice :: [(Var, CoreExpr)] -> Var -> [(Var, CoreExpr)] Source #

Selects those bindings that define the given variable

eqSlice :: [(Var, CoreExpr)] -> [(Var, CoreExpr)] -> Bool Source #

This is a heuristic, which only works if both slices have auxillary variables in the right order. (This is mostly to work-around the buggy CSE in GHC-8.0) It also breaks if there is shadowing.

freeOfType :: [(Var, CoreExpr)] -> Name -> Maybe (Var, CoreExpr) Source #

Returns True if the given core expression mentions no type constructor anywhere that has the given name.

doesNotAllocate :: [(Var, CoreExpr)] -> Maybe (Var, CoreExpr) Source #

True if the given variable binding does not allocate, if called fully satisfied.

It currently does not look through function calls, which of course could allocate. It should probably at least look through local function calls.

The variable is important to know the arity of the function.