[Haskell-cafe] Monad transformer responsibilities
Stephan Friedrichs
deduktionstheorem at web.de
Mon Jun 8 07:06:30 EDT 2009
Henning Thielemann wrote:
> [...]
>
>> - So you have to declare them near the test cases and they're orphan
>> instances
>>
>> The entire project doesn't issue a single warning when compiling with
>> -Wall *except* two orphan instances when building the test cases...
>
> However, I had sometimes the case, where a type from another library was
> part of my tests and thus I needed its Arbitrary instance. I could have
> defined instances for the foreign types, but they would have been orphan
> and I risk that the library author decides to add the instances later.
>
Hmm... maybe it is a good idea to aktivate the instance declaration with
a cabal flag? I've already got:
Flag Test
Description: Build a binary running test cases
Default: False
and I could easily add something like
if flag( Test )
CPP-Options: -D__TEST__
Build-Depends: QuickCheck >= 2 && < 3
and
data MyType = ...
#ifdef __TEST__
instance Arbitrary MyType where
...
#endif
A usage of cabal flags that strongly reminds me of Gentoo's useflags :)
However, this will result in a total mess with more than one such flag...
//Stephan
--
Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.
- Dieter Nuhr
More information about the Haskell-Cafe
mailing list