[darcs-devel] [patch1850] introduce TestOnly class

Ben Franksen bugs at darcs.net
Tue Jul 16 08:58:23 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

> pattern synonyms seem to work (I guess bidirectional ones would too), e.g.:
> 
>   pattern PrimP
>     :: TestOnly => NamedPrim prim wX wY -> RepoPatchV3 prim wX wY
>   pattern PrimP prim <- Prim prim
> 
> But it is still boilerplate.

Could you extend this example (unidirectional) to cover all
constructors, including the single use site in the harness, ideally as a
patch? It may be the (syntactic) overhead isn't as bad as I thought. The
main difficulty may be to come up with a suitable naming convention.

>> Here is a completely different idea: we add WARNING pragmas.
> 
> The disadvantage of these is that they aren't transitive,

True. Though I guess we would fix any such warnings soon and not wait
until other code depends on it.

> and that
> disabling them means disabling deprecations from other imports too.

This is really a disadvantage. I thought we could live with it for the
test-suite, but it is clearly not ideal. We could lobby ghc HQ to add a
more fine-grained disabling of warnings coming from WARNING pragmas...

> Perhaps I also find TestOnly a bit more elegant, but I'm probably biased
> by having come up with it recently.

I am not and I agree that it is more elegant.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1850>
__________________________________


More information about the darcs-devel mailing list