Chapter 1. Starting Out

If you’re the horrible sort of person who doesn’t read introductions, you might want to go back and read the last section anyway—it explains how to use this book, as well as how to load functions with GHC.

First, let’s start GHC’s interactive mode and call some functions, so we can get a very basic feel for Haskell. Open a terminal and type ghci. You will be greeted with something like this:

GHCi, version 8.0.1:  :? for help


GHCi’s default prompt is Prelude>, but we’ll be using ghci> as our prompt for the examples in this book. To make your prompt match the book’s, enter :set prompt "ghci> " into GHCi. If you don’t want to do this every time you run GHCi, create a file called .ghci

Get Learn You a Haskell for Great Good! now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.