{"id":321704,"date":"2016-11-14T21:02:56","date_gmt":"2016-11-15T05:02:56","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?post_type=msr-research-item&p=321704"},"modified":"2018-10-16T20:41:17","modified_gmt":"2018-10-17T03:41:17","slug":"functional-programming-input-output","status":"publish","type":"msr-research-item","link":"https:\/\/www.microsoft.com\/en-us\/research\/publication\/functional-programming-input-output\/","title":{"rendered":"Functional Programming and Input\/Output"},"content":{"rendered":"

A common attraction to functional programming is the ease with which proofs can be given of program properties. A common disappointment with functional programming is the difficulty of expressing input\/output (I\/O) while at the same time being able to verify programs. In this dissertation we show how a theory of functional programming can be smoothly extended to admit both an operational semantics for functional I\/O and verification of programs engaged in I\/O.<\/p>\n

The first half develops the operational theory of a semantic metalanguage used in the second half. The metalanguage M<\/b> is a simply-typed lambda-calculus with product, sum, function, lifted and recursive types. We study two definitions of operational equivalence: Morris-style contextual equivalence, and a typed form of Abramsky’s applicative bisimulation. We prove operational extensionality for M<\/b>—that these two definitions give rise to the same operational equivalence. We prove equational laws that are analogous to the axiomatic domain theory of LCF and derive a co-induction principle.<\/p>\n

The second half defines a small functional language, H<\/b>, and shows how the semantics of H<\/b> can be extended to accommodate I\/O. H<\/b> is essentially a fragment of Haskell. We give both operational and denotational semantics for H<\/b>. The denotational semantics uses M<\/b> in a case study of Moggi’s proposal to use monads to parameterise semantic descriptions. We define operational and denotational equivalences on H<\/b> and show that denotational implies operational equivalence. We develop a theory of H<\/b> based on equational laws and a co-induction principle.<\/p>\n

We study simplified forms of four widely-implemented I\/O mechanisms: side-effecting, Landin-stream, synchronised-stream and continuation-passing I\/O. We give reasons why side-effecting I\/O is unsuitable for lazy languages. We extend the semantics of H<\/b> to include the other three mechanisms and prove that the three are equivalent to each other in expressive power.<\/p>\n

We investigate monadic I\/O, a high-level model for functional I\/O based on Wadler’s suggestion that monads can express interaction with state in a functional language. We describe a simple monadic programming model, and give its semantics as a particular form of state transformer. Using the semantics we verify a simple programming example.<\/p>\n


\n

Distinguished Dissertations in Computer Science<\/a>. Cambridge University Press, 1994. ISBN 0 521 47103 6 hardback. Publication dates 29 September 1994 (UK) and 27 January 1995 (USA).<\/p>\n

A PDF<\/a> version is available online since August 14, 2007, as permitted<\/a> by Cambridge University Press, who own the copyright.<\/p>\n","protected":false},"excerpt":{"rendered":"

A common attraction to functional programming is the ease with which proofs can be given of program properties. A common disappointment with functional programming is the difficulty of expressing input\/output (I\/O) while at the same time being able to verify programs. In this dissertation we show how a theory of functional programming can be smoothly […]<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"msr-url-field":"","msr-podcast-episode":"","msrModifiedDate":"","msrModifiedDateEnabled":false,"ep_exclude_from_search":false,"footnotes":""},"msr-content-type":[3],"msr-research-highlight":[],"research-area":[13560],"msr-publication-type":[193725],"msr-product-type":[],"msr-focus-area":[],"msr-platform":[],"msr-download-source":[],"msr-locale":[268875],"msr-field-of-study":[],"msr-conference":[],"msr-journal":[],"msr-impact-theme":[],"msr-pillar":[],"class_list":["post-321704","msr-research-item","type-msr-research-item","status-publish","hentry","msr-research-area-programming-languages-software-engineering","msr-locale-en_us"],"msr_publishername":"","msr_edition":"","msr_affiliation":"","msr_published_date":"1992-08-01","msr_host":"","msr_duration":"","msr_version":"","msr_speaker":"","msr_other_contributors":"","msr_booktitle":"","msr_pages_string":"","msr_chapter":"","msr_isbn":"","msr_journal":"","msr_volume":"","msr_number":"","msr_editors":"","msr_series":"","msr_issue":"","msr_organization":"Cambridge University Press","msr_how_published":"","msr_notes":"","msr_highlight_text":"","msr_release_tracker_id":"","msr_original_fields_of_study":"","msr_download_urls":"","msr_external_url":"","msr_secondary_video_url":"","msr_longbiography":"","msr_microsoftintellectualproperty":1,"msr_main_download":"321716","msr_publicationurl":"http:\/\/www.cambridge.org\/us\/academic\/subjects\/computer-science\/programming-languages-and-applied-logic\/functional-programming-and-inputoutput","msr_doi":"","msr_publication_uploader":[{"type":"file","title":"fpio","viewUrl":"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/11\/fpio.pdf","id":321716,"label_id":0},{"type":"file","title":"fpio-permission","viewUrl":"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/11\/fpio-permission.pdf","id":321719,"label_id":0},{"type":"url","title":"http:\/\/www.cambridge.org\/us\/academic\/subjects\/computer-science\/programming-languages-and-applied-logic\/functional-programming-and-inputoutput","viewUrl":false,"id":false,"label_id":0}],"msr_related_uploader":"","msr_attachments":[{"id":0,"url":"http:\/\/www.cambridge.org\/us\/academic\/subjects\/computer-science\/programming-languages-and-applied-logic\/functional-programming-and-inputoutput"},{"id":321719,"url":"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/11\/fpio-permission.pdf"},{"id":321716,"url":"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2016\/11\/fpio.pdf"}],"msr-author-ordering":[{"type":"user_nicename","value":"adg","user_id":30825,"rest_url":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/microsoft-research\/v1\/researchers?person=adg"}],"msr_impact_theme":[],"msr_research_lab":[199561],"msr_event":[],"msr_group":[],"msr_project":[],"publication":[],"video":[],"download":[],"msr_publication_type":"phdthesis","_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-research-item\/321704"}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-research-item"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/types\/msr-research-item"}],"version-history":[{"count":2,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-research-item\/321704\/revisions"}],"predecessor-version":[{"id":529610,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-research-item\/321704\/revisions\/529610"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/media?parent=321704"}],"wp:term":[{"taxonomy":"msr-content-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-content-type?post=321704"},{"taxonomy":"msr-research-highlight","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-research-highlight?post=321704"},{"taxonomy":"msr-research-area","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/research-area?post=321704"},{"taxonomy":"msr-publication-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-publication-type?post=321704"},{"taxonomy":"msr-product-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-product-type?post=321704"},{"taxonomy":"msr-focus-area","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-focus-area?post=321704"},{"taxonomy":"msr-platform","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-platform?post=321704"},{"taxonomy":"msr-download-source","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-download-source?post=321704"},{"taxonomy":"msr-locale","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-locale?post=321704"},{"taxonomy":"msr-field-of-study","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-field-of-study?post=321704"},{"taxonomy":"msr-conference","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-conference?post=321704"},{"taxonomy":"msr-journal","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-journal?post=321704"},{"taxonomy":"msr-impact-theme","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-impact-theme?post=321704"},{"taxonomy":"msr-pillar","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-pillar?post=321704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}