[GHC] #12178: Allow inline pragmas on pattern synonyms
GHC
ghc-devs at haskell.org
Fri Sep 28 02:19:32 UTC 2018
#12178: Allow inline pragmas on pattern synonyms
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner: (none)
Type: feature request | Status: new
Priority: high | Milestone: 8.8.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
| PatternSynonyms, newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> Why would a pattern synonym not get inlined by default, always?
The only disadvantage to inlining is code size; and that applies equally
to all inlining decisions, whether for pattern synonyms or any other
function. Consider
{{{
pattern P a = [[[[a]]]]
f x = P (x+1)
g y = P (y-1)
}}}
Here's what it compiles to, without inlining
{{{
$bP x = (:) ((:) ((:) ((:) x []) []) []) []
f x = $bP (x+1)
g y = $bP (y-1)
}}}
Yes, we could inline `$bP`:
{{{
f x = (:) ((:) ((:) ((:) (x+1) []) []) []) []
g y = (:) ((:) ((:) ((:) (y-1) []) []) []) []
}}}
But really nothing much was gained by inlining the builder `$bp`.
It's the same for matching.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12178#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list