Skip to main content
Skip header

Practical Functional Programming

* Exchange students do not have to consider this information when selecting suitable courses for an exchange stay.

Course Unit Code460-4144/01
Number of ECTS Credits Allocated4 ECTS credits
Type of Course Unit *Optional
Level of Course Unit *Second Cycle
Year of Study *First Year
Semester when the Course Unit is deliveredWinter Semester
Mode of DeliveryFace-to-face
Language of InstructionCzech
Prerequisites and Co-Requisites There are no prerequisites or co-requisites for this course unit
Name of Lecturer(s)Personal IDName
BEH01Ing. Marek Běhálek, Ph.D.
Summary
Functional style of programming is well established, but for decades it was mostly used in universities and frequently it was treated like a nice concept without real practical application. Pure functional languages like Haskell, were rarely used for real life applications. Right now, functional style of programing is going through a sort of renaissance. It is embedded into many of the most popular multiparadigm languages like Python, Javascript or C#. Moreover, new pure functional languages like Scala, F# or Clojure emerged and become widely used. Even more, with the usage of JVM (Scala) or .NET CLR (F#) it is even easier to have a project accommodating various styles of programming.

In this subject, we will focus on practical aspects of applications development using pure functional programming languages Haskell and Elm. As a key project we will create a web-based information system, where the front end will be implemented in Elm and the back end will be in Haskell. They will be connected through REST Api. Moreover, we will address other issues as the usage of database or parsing various data formats. On this project, it will be demonstrated, that these functional languages are well suited for the development of real-life applications. Moreover, it will be pointed out, that their usage has some key advantages. Beside the programming itself, we will learn how to use some of the key infrastructure and tools supporting the development of real-life applications.
Learning Outcomes of the Course Unit
The aim of the course is to show the practical use of purely functional programming languages for the development of real-life applications. As a key project, a web-based information system will be implemented. The front part will be implemented in Elm and the back end will be in Haskell. In the project, also other aspects such as the usage of a database or the processing of various data formats will be addressed. In addition to pure functional programming languages and the related functional style of programming itself, students will also learn selected tools and a programming environment, that is necessary to build more complex applications.

After completing the course, participants will be able to practically apply a functional style of programming to solve real-life problems. They will be able to evaluate, if it is suitable to use It in given context and what advantages or disadvantages such approach will bring. They will get acquainted in more detail with the programming languages Haskell and Elm (both are syntactically very similar). They will also learn more about the functional style of programming, which can be useful also in other technologies than for purely functional programming languages. Most of today's dominant technologies support many programming paradigms and it is more a choice of the programmer, which style will be used in the solution. The course enables you to use the functional style of programming in many aspects regardless of the used environment.
Course Contents
Syllabus of presentations

Introduction to language Haskell, introduction to functional style of programming.
1. Introduction - Haskell platform, GHCI interpreter, simple recursion, simple functions.
2. Functions - solving more complex problems, basic libraries, introduction to type classes.
3. Lists and user defined data types – basic usage, introduction to list generators, functional way of solving problems
.
Tools for functional programming
4. Tools for project and library management (Stack, Cabal) and development support tools (eg debugger).
5. Testing

Advanced aspects of Haskell programming
6. Programming with actions - theoretical aspects, monads, examples (ST monad).
7. Input and output, handling errors.

Selected Haskell libraries
8. Processing of selected data formats (JSON, XML), input parsing.
9. Parallel programming, networking, web REST api.
10. Using the database.
11. Haskell GUI

Web GUI in ELM language.
12. Elm - basic components.
13. Elm - selected technologies, application of styles.
14. Elm - connection to the backend in language Haskell.

The content of the exercises will be corresponding to the presentations. We assume, that all exercises will be in computer classrooms.
Recommended or Required Reading
Required Reading:
[1] Bryan O'Sullivan, John Goerzen, and Don Stewart. 2008. Real World Haskell (1st. ed.). O'Reilly Media, Inc. Available online: http://book.realworldhaskell.org/

[2] Lipovaca M.:Learn You a Haskell for Great Good!: A Beginner's Guide (1st ed.). No Starch Press, San Francisco, CA, USA, 2011. Available online: http://learnyouahaskell.com/
[1] Bryan O'Sullivan, John Goerzen, and Don Stewart. 2008. Real World Haskell (1st. ed.). O'Reilly Media, Inc. Dostupné online: http://book.realworldhaskell.org/

[2] Lipovaca M.:Learn You a Haskell for Great Good!: A Beginner's Guide (1st ed.). No Starch Press, San Francisco, CA, USA, 2011. Dostupné online: http://learnyouahaskell.com/
Recommended Reading:
[3] Thompson S.: The Haskell: The Craft of Functional Programming (3nd ed.). Addison-Wesley Professional, October 2, 2011, ISBN-10: 0201882957.
[3] Thompson S.: The Haskell: The Craft of Functional Programming (3nd ed.). Addison-Wesley Professional, October 2, 2011, ISBN-10: 0201882957.
Planned learning activities and teaching methods
Lectures, Tutorials
Assesment methods and criteria
Task TitleTask TypeMaximum Number of Points
(Act. for Subtasks)
Minimum Number of Points for Task Passing
Graded creditGraded credit100 51