| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Expr.Reflection
Synopsis
- type ASTCheck = [Dec] -> Q ()
- isComprehentionD :: Dec -> Q ()
- callStartsWithOneOfD :: [Name] -> Dec -> Q ()
- callStartsWithOneOfD' :: Bool -> [Name] -> Dec -> Q ()
- callStartsWithOneOfE :: [Name] -> Exp -> Q ()
- callStartsWithOneOfE' :: Bool -> [Name] -> Exp -> Q ()
- onFunD :: [Dec] -> String -> (Dec -> Q ()) -> Q ()
- onFunBodyExp :: Dec -> (Exp -> Q ()) -> Q ()
- singleClauseFunWithoutGuards :: Dec -> Q ()
- hasConstructorE :: Constr -> String -> Exp -> Q ()
Assertion types
type ASTCheck = [Dec] -> Q () #
Any function with type ASTCheck declared in the teacher's file will be
executed if reflection is enabled
Declaration checks
isComprehentionD :: Dec -> Q () #
Fails if a declaration is not a list comprehention
callStartsWithOneOfD :: [Name] -> Dec -> Q () #
Version of callStartsWithOneOfD' which does not accept function composition
callStartsWithOneOfD' :: Bool -> [Name] -> Dec -> Q () #
Accepts a function which is defined in term of given names. The function must not have multiline declarations. The first argument specifies if functional composition is allowed.
callStartsWithOneOfE :: [Name] -> Exp -> Q () #
Version of callStartsWithOneOfE' which does not accept function composition
callStartsWithOneOfE' :: Bool -> [Name] -> Exp -> Q () #
onFunD :: [Dec] -> String -> (Dec -> Q ()) -> Q () #
Runs given check on function declarations of given name (on the actual
definition lines, i.e. FunD or ValD, not on type signature). The
function must exist, otherwise fail is raised.
onFunBodyExp :: Dec -> (Exp -> Q ()) -> Q () #
singleClauseFunWithoutGuards :: Dec -> Q () #
hasConstructorE :: Constr -> String -> Exp -> Q () #
Check if the given expression contains a subexpression created by given constructor