160x Filetype PDF File size 0.52 MB Source: www.cmi.ac.in
NotesonthehistoryoffunctionalprogrammingandHaskell June6,2018 SebastianMuskalla TUBraunschweig Summerterm2018 Contents Preface 1 Literature 2 NotesonthehistoryoffunctionalprogrammingandHaskell 3 Lecturesyllabus 9 Preface ThesearenotesforthefirstofmylecturesonfunctionalprogramminginHaskelltaughtatTUBraun- schweiginthesummertermof2018. Itcontainsashortoverviewofthehistoryoffunctionalprogram- mingandthedevelopmentofHaskell. The other lectures that are concerned with presenting Haskell and its concepts are not covered by thesenotes(exceptfortheLecturesyllabus)However,thereisanabundanceofmaterialonlearning Haskell that anybodywhoisinterestedcanusetogetstarted(seeLiterature). Furthermore,thecode examplesthatwereusedinthelectureareavailablehere: https://labrador.tcs.cs.tu-bs.de/fp/code_examples. In case you spot a bug in these notes, please send me a mail: s.muskalla@tu-bs.de. SebastianMuskalla Braunschweig,June6,2018 Literature Themainresourcethatwasusedtopreparethelecturesisthebook “ThinkingfunctionallywityhHaskell” R. Bird. CambridgeUniversityPress,2015. Otherresourcesthatwereusedinclude: • “Software-Entwicklung1” A. Poetzsch-Heffter. Lectureslides, TUKaiserslautern, 2009(inGerman). • “FortgeschrittenefunktionaleProgrammierunginHaskell” J. Betzendahl, S. Dresselhaus. Lectureslides, Universität Bielefeld, 2016 (in German). https://github.com/FFPiHaskell/Vorlesung2016 • “FunktionaleProgrammierung” J. Knoop. Lectureslides, TUWien,2017(inGerman). • “FortgeschrittenefunktionaleProgrammierung” J. Knoop. Lectureslides, TUWien,2018. • “Methodical, industrial software-engineering using the Haskell functional programming pan- guage” H.V.Riedel Lectureslides, TUWien,2017. • “LearnyouaHaskellforgreatgood!” MiranLipovača NoStarchPress,2011. http://learnyouahaskell.com • “Functionalprogramming” P. Wadler Lecture, University of Edinburgh, 2011. • “Thefirst monadtutorial” P. Wadler Talk, YOW!2013. https://www.youtube.com/watch?v=yjmKMhJOJos • “WhatIWishIKnewWhenLearningHaskell” S. Diehl http://dev.stephendiehl.com/hask/ • andtheHaskellWiki,e.g.https://wiki.haskell.org/What_a_Monad_is_not. NotesonthehistoryoffunctionalprogrammingandHaskell Historyofprogramming • Early computers: Strict separation between program (e.g. electronic circuits) and data (e.g. punch cards) • von Neumannarchitecture: program and data share the same memory (stored-program com- puters) • von Neumann-style imperative programing: Commands/statements (representing state changes)vs. expressions(representingdata) • Imperativeprogramsaresequencesofcommands(withjumps,e.g.realizedviago to) • Dijkstra 1968: “Go To statement consideredharmful” ↰ Structuredprogramming(if,while,...) &proceduralprogramming • Proceduralprograms: Functionalityrealizedbyproceduresthatcancalleachother • Procedures have explicit parameters and return values, but still have side effects (like reading andwritingtheglobalstateandintersectionwiththeoutsideworld) • John Backus (Fortran language designer) in his Turing Award lecture 1977 “Can programming beliberatedfromthevonNeumannstyle?” ↰ Boostofresearchintofunctionalprogramming Whatisfunctionalprogramming? • A (pure) function is a procedure without side effects: It can only read immutable parts of the globalstate • Pure functions are functions in the sense of mathematics: If x = y, then f(x) = f(y), no matter wherethisexpressionoccursinthecode. • In functional programming,functionalityisrealizedbycomposingfunctions • In the ideal case: No commands/statements,onlyexpressions Historyoffunctionalprogramming • Since1950s: LISPanditsdialects • After Backus’ lecture: Research into functional programming becamepopular... • butitspracticalapplicationswerelimitedtospecialfields(e.g.Erlang(since1986)forcommuni- cationsystems) • In the last 10 years: Rise of functional programming and multi-paradigmlanguages Languages • Non-pure functional languages: LISP (including dialects like Clojure, Scheme), ML (including dialects like (O)Caml), Erlang, … • Multi-paradigmlanguages: Python,Ruby,JavaScript,… • Rise andfall of Scala (around 2010) • SinceJava8(2014)andC++11: SomefunctionalconceptsinJavaandC++ • Nowadays: Almost no new language without functional programming (Apples’s Swift, Kotlin, Ceylon). Counter-example: Google’sGo. Haskell • Since1986 • NamedafterthelogicianHaskellCurry(1900-1982) • Onlypopularpurefunctionallanguage • AccordingtoR.Bird: Themostradicalfunctionallanguage • – Compiled(butalsohasaninterpreter) – Non-strictsemantics,Lazyevaluation – Strongstatictyping – Conceptsfromcategorytheorylikemonads • Initially mostly a scientific project, but increasing use in practice in the last years Environment • TheHaskellplatformincludingtheGHCisthede-factostandardimplementation • compilerGHC:(Glorious)GlasgowHaskellCompiler • “interpreter” GHCi: GlasgowHaskellCompilerinteractiveversion • Warning: The default values of some settings (“language pragmas”) differ by default between GHCiundGHC • NopopularIDEspecificallyforHaskell • Usedbymeduringthelecture: IntelliJIDEAwithHaskForceplugin
no reviews yet
Please Login to review.