Were usage types ever in GHC

Simon Peyton Jones simonpj at microsoft.com
Fri Jan 22 17:01:22 UTC 2016


Keith Wansbrough did implement his thesis work in a fork of GHC.  But (a) it was jolly complicated and pervasive, and (b) the performance improvements were not great.  It didn't pay its way. So we dropped it.  See his thesis, available here http://research.microsoft.com/en-us/um/people/simonpj/papers/papers.html

What we HAVE done (and is in GHC) is cardinality analysis. See "Higher order cardinality analysis in theory and practice"
http://research.microsoft.com/en-us/um/people/simonpj/papers/usage-types/usage.htm

Enjoy!

Simon
| -----Original Message-----
| From: Glasgow-haskell-users [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Philip Dexter
| Sent: 21 January 2016 23:15
| To: GHC Users List <glasgow-haskell-users at haskell.org>
| Subject: Were usage types ever in GHC
| 
| I've recently been digging around to see if there has ever been any
| attempt to perform any sort of data reuse optimization in functional
| languages.
| 
| Along with many other papers, I've come across `Once upon a type' as well
| as `Once upon a polymorphic type'. They both mention a desire to include a
| similar system in GHC.
| 
| Then in `Playing by the rules: rewriting as a practical optimization
| technique in GHC' I see usage types mentioned in section 5.3:
| 
| """
| To express this, GHC adds extra usage type arguments to map, both at its
| definition and at its call sites. Once this is done, a specialised version
| of map can be compiled for the case when the usage-type argument is
| “once”, and a rule generated to match such calls, in exactly the same way
| as for specialising overloading.
| """
| 
| I can't tell if this is simply a hypothetical optimization or if this
| really happened at one point in the history of GHC.
| 
| I was hoping somebody could shed some light on this topic
| 
| Was a usage type system or something similar (e.g. linear type system)
| ever present in GHC?
| 
| If it was then why was it taken out (unless I'm missing something, this
| optimization is not happening today)? I could guess at this and say that
| the gains weren't worth the overhead, but perhaps there's another reason.
| 
| If it was never present, why not? There was obviously at least some
| interest in this sort of optimization at some point in the Haskell
| community and I'd be curious as to why it was never tested in GHC.
| 
| Thanks!
| 
| Philip Dexter


More information about the Glasgow-haskell-users mailing list