Are you as convinced as you were of the semantics of pattern synonyms?  I can see they are the right semantics given a run-time implementation but the alternative compile-time implementation has a lot to recommend it.

 

What exactly is “the alternative compile-time implementation”?

 

Remember, although pattern synonyms are set up to call a matching function, that matching function is often inlined, which reduces the overhead to zero.

 

I say “often” inlined.  An INLINE pragma for pattern synonyms would be a good feature.

 

Widening to ghc-devs.

 

Simon

 

 

From: Matthew Roberts <matthew.roberts@mq.edu.au>
Sent: 11 February 2019 00:10
To: matthew.pickering@cs.ox.ac.uk; gergo@erdi.hu; Simon Peyton Jones <simonpj@microsoft.com>; rae@cs.brynmawr.edu
Subject: Performance of pattern synonyms

 

Hi all,

 

I am working with someone on a compile-time pattern matching extension and the most important prior work is pattern synonyms in Haskell.  I hope you might indulge a couple of questions I have not been able to answer myself from the literature:

 

  * [In my testing](http://pattern-benchmarks.herokuapp.com/posts/2019-02-09-peano.html), pattern synonyms have remarkable performance, has anyone ever benchmarked them before?

  * Do you have - on hand - the hackage data you used in investigating uses of pattern synonyms?  I am looking for real-world usage of pattern matching extensions.

  * Are you as convinced as you were of the semantics of pattern synonyms?  I can see they are the right semantics given a run-time implementation but the alternative compile-time implementation has a lot to recommend it.

 

Thanks for your time,

 

Matt Roberts

Department of Computing, Macquarie University