Opened 2 years ago

Last modified 4 hours ago

#12178 new feature request

Allow inline pragmas on pattern synonyms

Reported by: mpickering Owned by:
Priority: high Milestone: 8.8.1
Component: Compiler Version: 8.0.1
Keywords: PatternSynonyms, newcomer Cc: bgamari, edsko
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Richard observes that it might be useful to allow inline pragmas to refer to pattern synonyms to ensure that the matcher is inlined.

The main question to resolve is whether {-# INLINE P #-} means to inline just the matcher, just the builder or both. It seems that without more fine grained control then the pragma should cause both the matcher and builder to be inline but I am not certain about this.

Change History (9)

comment:1 Changed 2 years ago by edsko

Cc: edsko added

comment:2 Changed 2 years ago by bgamari

Cc: bgamari added
Priority: normalhigh

Bumping the importance of this since you really should be able to use pattern synonyms in a manner without compromising performance.

Moreover, I wonder whether builders and matchers should be given a bit of a discount for their inlining cost, reflecting the user's likely intuition that patterns synonyms are generally cheap and small.

I agree that a simple INLINE P pragma should inline both the matcher and the builder of P. Indeed we could expose INLINE_MATCHER and INLINE_BUILDER variants as well, although I am doubtful that they would pull their weight.

Last edited 2 years ago by bgamari (previous) (diff)

comment:3 Changed 2 years ago by goldfire

I hate to say it, but I feel confident someone will want the finer control here. But I suppose there would be no barrier to implementing the finer control later and so we should start with the simpler version.

comment:4 Changed 2 years ago by bgamari

Milestone: 8.2.1

comment:5 Changed 19 months ago by bgamari


Sadly this won't happen for 8.2.

Last edited 19 months ago by bgamari (previous) (diff)

comment:6 Changed 13 months ago by osa1

Owner: set to osa1

I have some time to work on GHC these days and I'll be working on this feature.

comment:7 Changed 8 months ago by bgamari

Keywords: newcomer added

Perhaps we'll be able to get this done for 8.6.

comment:8 Changed 3 months ago by bgamari


This won't happen for 8.8.

comment:9 Changed 4 hours ago by osa1

Owner: osa1 deleted
Note: See TracTickets for help on using tickets.