subhask-0.1.1.0: Type safe interface for programming in subcategories of Hask

Safe HaskellNone
LanguageHaskell2010

SubHask.TemplateHaskell.Test

Synopsis

Documentation

testMap :: Map String [String] Source

Ideally, this map would be generated automatically via template haskell. Due to bug #9699, however, we must enter these manually.

mkClassTests :: Name -> Q Exp Source

makes tests for all instances of a class that take no type variables

mkSpecializedClassTest Source

Arguments

:: Type

type to create tests for

-> Name

class to create tests for

-> Q Exp 

Given a type and a class, searches "testMap" for all tests for the class; then specializes those tests to test on the given type

mkSpecializedClassTests :: Q Type -> [Name] -> Q Exp Source

Like "mkSpecializedClassTests", but takes a list of classes

specializeType Source

Arguments

:: Type

type with variables

-> Type

instantiate variables to this type

-> Type 

replace all variables with a concrete type

specializeLaw Source

Arguments

:: Type

type to specialize the law to

-> Name

law (i.e. function) that we're testing

-> Q Exp 

mkTest Source

Arguments

:: Type

type to specialize the law to

-> Name

law (i.e. function) that we're testing

-> Q Exp 

creates an expression of the form:

testProperty "testname" (law_Classname_testname :: typeName -> ... -> Bool)

mkTests :: Type -> [Name] -> Q Exp Source

Like "mkTest", but takes a list of laws and returns a list of tests

extractTestStr :: Name -> String Source

takes a Name of the form

law_Class_test

and returns the string

test