2WRITING BASIC FUNCTIONS

Image

The function is the central idea of functional programming. In this chapter, we’ll learn how to define functions and constants and how to use those functions and constants in GHCi. We’ll discuss the language we use to talk about functions, and we’ll see how communicating with computers often requires more precision than communicating with people. We’ll then introduce Haskell’s system of anonymous functions, which are functions without a name. After a brief glimpse of Haskell’s type system (which we’ll describe more in Chapter 3), we’ll show how the function composition operator can be used to compose functions. Finally, ...

Get Learn Physics with Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.