Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides Template Haskell splices that can be used to derive
boilerplate instances for HMock. makeMockable
implements the common case
where you just want to generate everything you need to mock with a class.
The variant makeMockableWithOptions
is similar, but takes an options
parameter that can be used to customize the generation.
Synopsis
- data MakeMockableOptions = MakeMockableOptions {}
- makeMockable :: Q Type -> Q [Dec]
- makeMockableWithOptions :: Q Type -> MakeMockableOptions -> Q [Dec]
Documentation
data MakeMockableOptions Source #
Custom options for deriving MockableBase
and related instances.
MakeMockableOptions | |
|
Instances
Default MakeMockableOptions Source # | |
Defined in Test.HMock.TH |
makeMockable :: Q Type -> Q [Dec] Source #
Defines all instances necessary to use HMock with the given type, using
default options. The type should be a type class extending Monad
, applied
to zero or more type arguments.
This defines all of the following instances, if necessary:
MockableBase
and the associatedAction
andMatcher
types.Expectable
instances for theAction
type.Mockable
with an empty setup.- Instances of the provided application type class to allow unit tests to be
run with the
MockT
monad transformer.
makeMockableWithOptions :: Q Type -> MakeMockableOptions -> Q [Dec] Source #
Defines all instances necessary to use HMock with the given type, using
the provided options. The type should be a type class extending Monad
,
applied to zero or more type arguments.
This defines the following instances, if necessary:
MockableBase
and the associatedAction
andMatcher
types.Expectable
instances for theAction
type.- If
mockEmptySetup
isTrue
:Mockable
with an empty setup. - If
mockDeriveForMockT
isTrue
: Instances of the provided application type class to allow unit tests to be run with theMockT
monad transformer.