Were usage types ever in GHC

Philip Dexter philip.dexter at gmail.com
Thu Jan 21 23:14:57 UTC 2016

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 

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.


Philip Dexter

More information about the Glasgow-haskell-users mailing list