From 6345f29d36856cc43969a9e43a553e4d1ff10d7d Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 12 May 2003 09:22:35 +0000 Subject: [PATCH] [project @ 2003-05-12 09:22:35 by simonmar] Updates: - Loading module Main without a main binding is no longer an error. - Clarify the section on libraries to note that it means object-code libraries, not source code. - Update the section on packages now that most packages are auto-loaded. --- ghc/docs/users_guide/ghci.sgml | 56 +++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/ghc/docs/users_guide/ghci.sgml b/ghc/docs/users_guide/ghci.sgml index 0ba4d8d..f7a6e06 100644 --- a/ghc/docs/users_guide/ghci.sgml +++ b/ghc/docs/users_guide/ghci.sgml @@ -162,7 +162,7 @@ Ok, modules loaded: Main. indirectly, by the topmost module, and load them all in dependency order. - + Modules vs. filenames modulesand filenames filenamesof modules @@ -207,10 +207,6 @@ Ok, modules loaded: Main. which GHCi can't find a source file, even if there are object and interface files for the module, you'll get an error message. - - One final note: if you load a module called Main, it must - contain a main function, just like in - GHC. @@ -672,26 +668,33 @@ $ ghci Main.hs Packages packageswith GHCi - GHCi can make use of all the packages that come with GHC, - For example, to start up GHCi with the network - package loaded: + Most packages (see ) are + available without needing to specify any extra flags at all: + they will be automatically loaded the first time they are + needed. + + For non-auto packages, however, you need to request the + package be loaded by using the -package flag: -$ ghci -package network +$ ghci -package data ___ ___ _ / _ \ /\ /\/ __(_) - / /_\// /_/ / / | | GHC Interactive, version 5.04, for Haskell 98. + / /_\// /_/ / / | | GHC Interactive, version 5.05, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Loading package haskell98 ... linking ... done. -Loading package network ... linking ... done. +Loading package lang ... linking ... done. +Loading package concurrent ... linking ... done. +Loading package readline ... linking ... done. +Loading package unix ... linking ... done. +Loading package posix ... linking ... done. +Loading package util ... linking ... done. +Loading package data ... linking ... done. Prelude> - - - Note that GHCi will also automatically load any packages - on which the requested package depends. + The following command works to load new packages into a running GHCi: @@ -702,7 +705,7 @@ Prelude> :set -package name But note that doing this will cause all currently loaded modules to be unloaded, and you'll be dumped back into the - Prelude. + Prelude. @@ -711,7 +714,10 @@ Prelude> :set -package name Extra libraries may be specified on the command line using the normal -llib - option. For example, to load the “m” library: + option. (The term library here refers to + libraries of foreign object code; for using libraries of Haskell + source code, see .) For + example, to load the “m” library: $ ghci -lm @@ -1222,22 +1228,6 @@ Prelude> :set -fno-glasgow-exts - GHCi complains about main not being - in scope when I load a module. - mainwith GHCi - - - You probably omitted the module - declaration at the top of the module, which causes the - module name to default to Main. In - Haskell, the Main module must define a - function called main. Admittedly this - doesn't make a great deal of sense for an interpreter, but - the rule was kept for compatibility with GHC. - - - - The interpreter can't load modules with foreign export declarations! -- 1.7.10.4