Once upon a type

Anumber of useful optimisations are enabled if wecan determine when a value is accessed at most once. We extend the Hindley-Milner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higher-order functions and data structures, and admits principal types for terms. Unlike previous analyses, we prove our analysis sound with respect to call-by-need reduction. Call-by-name reduction does notprovide inaccurate model ofhowoften a value is used during lazy evaluation, since it duplicates work which would actually be shared in a real implementation. Ourtype system caneasily remodified toanalyse usage in a call-by-value language.

[1]  Simon L. Peyton Jones,et al.  Avoiding Unnecessary Updates , 1992, Functional Programming.

[2]  S. Courtenage,et al.  Analysing resource use in the-calculus by type inference , 1994 .

[3]  Joannes M. Lucassen Types and Effects Towards the Integration of Functional and Imperative Programming. , 1987 .

[4]  Simon L. Peyton Jones,et al.  Time and space profiling for non-strict, higher-order functional languages , 1995, POPL '95.

[5]  Paul Hudak,et al.  Single-threaded polymorphic lambda calculus , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[6]  David K. Gifford,et al.  Polymorphic effect systems , 1988, POPL '88.

[7]  Philip Wadler Is there a use for linear logic , 1991 .

[8]  John C. Mitchell,et al.  Coercion and type inference , 1984, POPL.

[9]  David A. Schmidt Detecting global variables in denotational specifications , 1985, TOPL.

[10]  Philip Wadler,et al.  The Glasgow Haskell Compiler: a technical overview , 1993 .

[11]  Clement A. Baker-Finch,et al.  Usage Analysis with Natural Reduction Types , 1993, WSA.

[12]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[13]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[14]  Philip Wadler,et al.  Glasgow Workshop on Functional Programming , 1992 .

[15]  Philip Wadler,et al.  Deforestation: Transforming Programs to Eliminate Trees , 1990, Theor. Comput. Sci..

[16]  Henry G. Baker,et al.  Unify and conquer , 1990, LISP and Functional Programming.

[17]  Jean-Yves Girard,et al.  Linear Logic , 1987, Theor. Comput. Sci..

[18]  Philip Wadler,et al.  Deforestation for Higher-Order Functions , 1992, Functional Programming.

[19]  Philip Wadler,et al.  Is there a use for linear logic? , 1991, PEPM '91.

[20]  John C. Mitchell,et al.  Type inference with simple subtypes , 1991, Journal of Functional Programming.

[21]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[22]  Pierre Jouvelot,et al.  Algebraic reconstruction of types and effects , 1991, POPL '91.

[23]  Simon L. Peyton Jones,et al.  The spineless tagless G-machine , 1989, FPCA.

[24]  Matthias Felleisen,et al.  A call-by-need lambda calculus , 1995, POPL '95.

[25]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[26]  Lennart Augustsson,et al.  Implementing Haskell overloading , 1993, FPCA '93.

[27]  Jean-Yves Girard,et al.  On the Unity of Logic , 1993, Ann. Pure Appl. Log..

[28]  Martin Odersky,et al.  Call-by-name, call-by-value, call-by-need and the linear lambda calculus , 1995, MFPS.

[29]  John Launchbury,et al.  A natural semantics for lazy evaluation , 1993, POPL '93.

[30]  University of Glasgow , 1862, Nature.

[31]  Paul Hudak A semantic model of reference counting and its abstraction (detailed summary) , 1986, LFP '86.

[32]  Patrick Lincoln,et al.  Linear logic , 1992, SIGA.

[33]  Simon Marlow Update Avoidance Analysis by Abstract Interpretation , 1993, Functional Programming.

[34]  Simon L. Peyton Jones,et al.  A short cut to deforestation , 1993, FPCA '93.

[35]  Erik Barendsen,et al.  Conventional and Uniqueness Typing in Graph Rewrite Systems , 1993, FSTTCS.

[36]  André L. M. Santos,et al.  Compilation by Transformation in the Glasgow Haskell Compiler , 1994, Functional Programming.

[37]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.