Trends in Functional Programming, Transformational and Programming Generic Programming to Type Checking and Volume6 Designing New Classes of Data Types
Total Page:16
File Type:pdf, Size:1020Kb
This book presents latest research developments van Eekelen Trends in in the area of functional programming. The contributions in this volume cover a wide Functional range of topics from theory, formal aspects of Trends in functional programming, transformational and Programming generic programming to type checking and Volume6 designing new classes of data types. Functional Not all papers in this book belong to the Edited by Marko Van Eekelen category of research papers. Also, the categories of project description (at the start Trends in Trends Functional Programming Programming of a project) and project evaluation (at the end of a project) papers are represented. Particular trends in this volume are: T software engineering techniques such Volume6 as metrics and refactoring for high-level programming languages; T generation techniques for data type elements Edited by Marko van Eekelen as well as for lambda expressions; T analysis techniques for resource consumption with the use of high-level programming languages for embedded systems; T widening and strengthening of the theoretical foundations. The TFP community (www.tifp.org) is dedicated to promoting new research directions related to the field of functional programming and to investigate the relationships of functional 6 Volume programming with other branches of computer science. It is designed to be a platform for novel and upcoming research. Dr. Marko van Eekelen is an associate professor in the Security of Systems Department of the Institute for Computing and Information Sciences, Radboud University, Nijmegen. intellect PO Box 862, Bristol BS99 1DE, United Kingdom / www.intellectbooks.com intellect ISBN 978-1-84150-176-5 0 0 9 781841 501765 TFP6Prelims 1/6/07 14:30 Page 1 Trends in Functional Programming Volume 6 Edited by Marko van Eekelen Radboud University, Nijmegen TFP6Prelims 1/6/07 14:30 Page 2 First Published in the UK in 2007 by Intellect Books, PO Box 862, Bristol BS99 1DE, UK First published in the USA in 2007 by Intellect Books, The University of Chicago Press, 1427 E. 60th Street, Chicago, IL 60637, USA Copyright © 2007 Intellect All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission. A catalogue record for this book is available from the British Library. Cover Design: Gabriel Solomons ISBN 978-1-84150-176-5/EISBN 978-184150-990-7 Printed and bound by Gutenberg Press, Malta. Contents 1 Best student Paper: A New Approach to One-Pass Transformations 1 Kevin Millikin 1.1 Introduction . 1 1.2 Cata/build Fusion for ¸-Terms . 3 1.3 The Call-by-value CPS Transformation Using Build . 3 1.4 A Catamorphic Normalization Function . 4 1.5 A New One-Pass Call-by-value CPS Transformation . 6 1.6 Suppressing Contraction of Source Redexes . 7 1.7 Comparison to Danvy and Filinski's One-Pass CPS Transfor- mation . 8 1.8 A New One-Pass Call-by-name CPS Transformation . 9 1.9 Related Work and Conclusion . 10 References . 11 2 A Static Checker for Safe Pattern Matching in Haskell 15 Neil Mitchell and Colin Runciman 2.1 Introduction . 15 2.2 Reduced Haskell . 16 2.3 A Constraint Language . 18 2.4 Determining the Constraints . 20 2.5 A Worked Example . 24 2.6 Some Small Examples and a Case Study . 25 2.7 Related Work . 28 2.8 Conclusions and Further Work . 29 References . 30 3 Software Metrics: Measuring Haskell 31 Chris Ryder, Simon Thompson 3.1 Introduction . 31 3.2 What Can Be Measured . 33 3.3 Validation Methodology . 38 3.4 Results . 40 3.5 Conclusions and Further Work . 44 References . 46 4 Type-Specialized Serialization with Sharing 47 Martin Elsman 4.1 Introduction . 47 4.2 The Serialization Library . 49 4.3 Implementation . 52 4.4 Experiments with the MLKit . 58 i 4.5 Conclusions and Future Work . 60 References . 61 5 Logical Relations for Call-by-value Delimited Continuations 63 Kenichi Asai 5.1 Introduction . 63 5.2 Preliminaries . 65 5.3 Specializer for Call-by-name ¸-Calculus . 66 5.4 Logical Relations for Call-by-value ¸-Calculus . 68 5.5 Specializer in CPS . 68 5.6 Specializer in Direct Style . 70 5.7 Interpreter and A-normalizer for Shift and Reset . 71 5.8 Specializer for Shift and Reset . 72 5.9 Type System for Shift and Reset . 75 5.10 Logical Relations for Shift and Reset . 76 5.11 Related Work . 76 5.12 Conclusion . 77 References . 77 6 Epigram Reloaded: A Standalone Typechecker for ETT 79 James Chapman, Thorsten Altenkirch, Conor McBride 6.1 Introduction . 79 6.2 Dependent Types and Typechecking . 80 6.3 Epigram and Its Elaboration . 82 6.4 ETT Syntax in Haskell . 85 6.5 Checking Types . 86 6.6 From Syntax to Semantics . 89 6.7 Checking Equality . 91 6.8 Related Work . 92 6.9 Conclusions and Further Work . 93 References . 93 7 Formalisation of Haskell Refactorings 95 Huiqing Li, Simon Thompson 7.1 Introduction . 95 7.2 Related Work . 98 7.3 The ¸-Calculus with Letrec (¸LET REC ) . 99 7.4 The Fundamentals of ¸LET REC . 100 7.5 Formalisation of Generalising a De¯nition . 101 7.6 Formalisation of a Simple Module System ¸M . 103 7.7 Fundamentals of ¸M . 105 7.8 Formalisation of Move a de¯nition from one module to an- other in ¸M ............................106 7.9 Conclusions and Future Work . 109 ii References . ..............................110 8 Systematic Search for Lambda Expressions 111 Susumu Katayama 8.1 Introduction . 111 8.2 Implemented System . 113 8.3 E±ciency Evaluation . 121 8.4 Discussions for Further Improvements . 122 8.5 Conclusions . 123 References . 123 9 First-Class Open and Closed Code Fragments 127 Morten Rhiger 9.1 Introduction . 127 9.2 Open and Closed Code Fragments . 131 9.3 Syntactic Type Soundness . 137 9.4 Examples . 139 9.5 Related Work . 140 9.6 Conclusions . 141 References . 141 10 Comonadic Functional Attribute Evaluation 145 Tarmo Uustalu and Varmo Vene 10.1 Introduction . 145 10.2 Comonads and Dataflow Computation . 147 10.3 Comonadic Attribute Evaluation . 150 10.4 Related Work . 159 10.5 Conclusions and Future Work . 160 References . 160 11 Generic Generation of the Elements of Data Types 163 Pieter Koopman, Rinus Plasmeijer 11.1 Introduction . 163 11.2 Introduction to Automatic Testing . 165 11.3 Generic Test Data Generation in Previous Work . 167 11.4 Generic Test Data Generation: Basic Approach . 168 11.5 Pseudo-Random Data Generation . 172 11.6 Restricted Data Types . 174 11.7 Related Work . 176 11.8 Conclusion . 177 References . 177 iii 12 Extensible Record with Scoped Labels 179 Daan Leijen 12.1 Introduction . 179 12.2 Record operations . 181 12.3 The Types of Records . 183 12.4 Higher-Ranked Impredicative Records . 186 12.5 Type Rules . 187 12.6 Type Inference . 188 12.7 Implementing Records . 191 12.8 Related Work . 192 12.9 Conclusion . 193 References . 193 13 Project Start Paper: The Embounded Project 195 Kevin Hammond, Roy Dyckho®, Christian Ferdinand, Reinhold Heck- mann, Martin Hofmann, Ste®en Jost, Hans-Wolfgang Loidl, Greg Michael- son, Robert Pointon, Norman Scaife, Jocelyn S¶erot and Andy Wallace 13.1 Project Overview . 196 13.2 The Hume Language . 198 13.3 Project Work Plan . 199 13.4 The State of the Art in Program Analysis for Real-Time Em- bedded Systems . 204 13.5 Existing Work by the Consortium . 206 13.6 Conclusions . 208 References . 208 14 Project Evaluation Paper: Mobile Resource Guarantees 211 Donald Sannella, Martin Hofmann, David Aspinall, Stephen Gilmore, Ian Stark, Lennart Beringer, Hans-Wolfgang Loidl, Kenneth MacKenzie, Alberto Momigliano, Olha Shkaravska 14.1 Introduction . 211 14.2 Project Objectives . 212 14.3 An Infrastructure for Resource Certi¯cation . 213 14.4 A PCC Infrastructure for Resources . 218 14.5 Results . ..