Re: [Haskell-cafe] HPC question

2012-05-23 Thread Andres Löh
Hi David.

 Now, if I fiddle in the .tix file by hand to fake a usage of (/=) by
 changing the 52nd entry from 0 to 1, the Eq instance isn't highlighted any
 more in the HTML output. More strangely, if I then remove the usage of (==)
 by changing the 51st entry from 1 to 0, the Eq instance still isn't
 highlighted. A similar effect happens with the Show instance. It seems to be
 highlighting based only on the last entry in the .tix file, where there are
 two or more identically-placed boxes. Is this right? I'd have expected that
 if I use (==) then the deriving (Eq) clause should be considered 'used'.

I've not looked at the .tix file, but a few tests seem to confirm what
I'd suspect. For derived instances, you have to cover *all* methods,
otherwise the type class will be shown as not covered. Now, in the
case of Eq that's both (==) and (/=), where the derived implementation
of (/=) happens to use the derived implementation of (==). So using
(==) alone is not sufficient, but using (/=) is. Similarly for Show,
where the class defines showList that you don't test.

 Secondly, I can't work out what the four boxes in position 15:6-15:9 are
 supposed to be. If I use -ddump-simpl I can see many calls to 'tick' but
 there's no mention of numbers 47, 49 or 50. Perhaps they've been simplified
 away? I'm afraid I don't know what else to try dumping to get at the
 instrumented code before the simplifier's had a go at it.

For the datatype, your use of field labels causes GHC to generate
accessor functions. These aren't covered by your tests. Therefore the
datatype shows as not completely covered.

HTH,
  Andres

-- 
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HPC question

2012-05-23 Thread David Turner

On 23/05/2012 11:22, Andres Löh wrote:

I've not looked at the .tix file, but a few tests seem to confirm what
I'd suspect. For derived instances, you have to cover *all* methods,
otherwise the type class will be shown as not covered.


Ok, I see. It's going to take me a while to cover all instances of this!


For the datatype, your use of field labels causes GHC to generate
accessor functions. These aren't covered by your tests. Therefore the
datatype shows as not completely covered.


Ah, yes, that makes sense.

Thanks,

David

--
David Turner
Senior Consultant
Tracsis PLC

Tracsis PLC is a company registered in
England and Wales with number 5019106.



smime.p7s
Description: S/MIME Cryptographic Signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HPC question

2012-05-23 Thread David Turner

On 23/05/2012 11:33, David Turner wrote:

On 23/05/2012 11:22, Andres Löh wrote:

I've not looked at the .tix file, but a few tests seem to confirm what
I'd suspect. For derived instances, you have to cover *all* methods,
otherwise the type class will be shown as not covered.


Ok, I see. It's going to take me a while to cover all instances of this!


For the datatype, your use of field labels causes GHC to generate
accessor functions. These aren't covered by your tests. Therefore the
datatype shows as not completely covered.


Ah, yes, that makes sense.


Further to that, however:

http://hpaste.org/68900

The extra test case (line 15) causes HPC not to highlight the Path (line 
18) indicating it is now used, even though there are uncovered accessors.


I'm confused.

Thanks in advance,

David



smime.p7s
Description: S/MIME Cryptographic Signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe