C.6 Running a Haskell Program

(Assuming a UNIX environment.)

  • Enter ghci at the command prompt and enter expressions interactively to evaluate them:

    A set of six code lines in Haskell with the entry g h c i and with the expressions entered interactively to evaluate them.
    Description

    Using this method of execution, the programmer can create bindings and define new functions at the prompt of the interpreter:

    A set of six code lines in Haskell for creating bindings and defining new functions at the prompt of the interpreter.
    Description

    Enter the EOF character (which is <ctrl-d> on UNIX systems and <ctrl-z> on Windows systems) or :quit (or :q) to quit the interpreter.

  • Enter ghci <filename>.hs from the command prompt using file I/O, which causes the program in <filename>.hs ...

Get Programming Languages: Concepts and Implementation 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.