HsPragTick

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

HsPragTick

Alan & Kim Zimmerman
I am working through the API Annotations, and have come across HsPragTick.

In source it appears as

  c = {-# GENERATED "foobar" 1 : 2  -  3 :   4 #-} 0.00

But it does not seem to be used anywhere. It is passed through for renaming and type checking, and Coverage.hs uses it as

addTickHsExpr (HsPragE _ HsPragTick{} (L pos e0)) = do
    e2 <- allocTickBox (ExpBox False) False False (locA pos) $
                addTickHsExpr e0
    return $ unLoc e2

So if it is used at all, the contents are ignored.

Can it be removed?

Alan

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: HsPragTick

Ryan Scott
I think that HsPragTick is unused as of [1]. In fact, I was under the impression that [1] removed HsPragTick entirely (as the commit message) would suggest, but upon further inspection, that doesn't appear to be the case. Vlad, do you recall why HsPragTick was kept around?

Ryan S.
-----

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: HsPragTick

Vladislav Zavialov-2
I was under impression it was somehow related to HPC. Since I'm not sufficiently familiar with HPC's inner workings, I kept it around just to be safe.

- Vlad

On Mon, Aug 31, 2020, 17:03 Ryan Scott <[hidden email]> wrote:
I think that HsPragTick is unused as of [1]. In fact, I was under the impression that [1] removed HsPragTick entirely (as the commit message) would suggest, but upon further inspection, that doesn't appear to be the case. Vlad, do you recall why HsPragTick was kept around?

Ryan S.
-----

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: HsPragTick

Richard Eisenberg-5
I'm content with ripping it out and waiting to see if anyone complains. Without documentation or any obvious users, it seems hard to do otherwise.

That said, if you reading this have a better idea than we do about who uses {-# GENERATED ... #-} pragmas, do speak up!

Thanks,
Richard

On Aug 31, 2020, at 10:07 AM, Vladislav Zavialov <[hidden email]> wrote:

I was under impression it was somehow related to HPC. Since I'm not sufficiently familiar with HPC's inner workings, I kept it around just to be safe.

- Vlad

On Mon, Aug 31, 2020, 17:03 Ryan Scott <[hidden email]> wrote:
I think that HsPragTick is unused as of [1]. In fact, I was under the impression that [1] removed HsPragTick entirely (as the commit message) would suggest, but upon further inspection, that doesn't appear to be the case. Vlad, do you recall why HsPragTick was kept around?

Ryan S.
-----
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: HsPragTick

Ben Gamari-2
In reply to this post by Alan & Kim Zimmerman
"Alan & Kim Zimmerman" <[hidden email]> writes:

> I am working through the API Annotations, and have come across HsPragTick.
>
> In source it appears as
>
>   c = {-# GENERATED "foobar" 1 : 2  -  3 :   4 #-} 0.00
>
> But it does not seem to be used anywhere. It is passed through for renaming
> and type checking, and Coverage.hs uses it as
>
> addTickHsExpr (HsPragE _ HsPragTick{} (L pos e0)) = do
>     e2 <- allocTickBox (ExpBox False) False False (locA pos) $
>                 addTickHsExpr e0
>     return $ unLoc e2
>
> So if it is used at all, the contents are ignored.
>
> Can it be removed?
>
I traced the pragma's addition back to
d386e0d20c6953b7cba4d53538a1782c4aa9980d (way back in 2006!). It appears
that it was intended to be used by code generators for use in informing
the code coveraging checker about generated code provenance. When it was
added it used the pragma's "payload" fields as source location
information to build an "ExternalBox". However, it looks like this
constructor was dropped in 55a5d8d90280a611bafb659bc80778d3927a6bff [2]
(only a year later!).

At this point it seems like the pragma serves no useful purpose. Given
that it *also* is not documented, I think we should remove it. I have
opened #18639 to track this.

Cheers,

- Ben


[1] https://gitlab.haskell.org/ghc/ghc/-/commit/d386e0d20c6953b7cba4d53538a1782c4aa9980d 
[2] https://gitlab.haskell.org/ghc/ghc/-/commit/55a5d8d90280a611bafb659bc80778d3927a6bff#a033dd77bd63482866f5d4f8ed130427c9000779_308_319

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (497 bytes) Download Attachment