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: http://www.haskell.org/ghc/  :? for help
Prelude>

Note

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 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.