Exploring Haskell Interactively

We’ll start our Haskell journey by diving into ghci to run some commands interactively. ghci is Haskell’s REPL, an interactive environment that lets you run commands, call functions, and even debug your programs. Most Haskell developers rely on ghci extensively as they develop their programs, and it’s a natural starting point for you to start familiarizing yourself with the basic syntax of the language. For instructions on getting ghci and the rest of your Haskell environment installed and configured, you can consult the instructions online at haskell.org.[1]

When you start up ghci you’ll see a default prompt:

 $ ​​ghci
 GHCi, version 9.4.2: https://www.haskell.org/ghc/ :? for help
 Prelude>

The first thing ...

Get Effective Haskell 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.