If no file names are specified, the :load command just removes any previously loaded definitions, leaving just the definitions provided by the prelude.
The :load command uses the list of directories specified by the current path to search for module files. We can specify the list of directory and filename pairs, in the order that they are searched, using a Haskell list comprehension:
[ (dir,file++suf) | dir <- [""] ++ path, suf <- ["", ".hs", ".lhs"]]The file mentioned here is the name of the module file that was entered by the user, while path is the current Hugs search path. The search starts with the directory "", which usually represents a search relative to the current working directory. So, the very first filename that the system tries to load is exactly the same filename entered by the user. However, if the named file cannot be accessed, then the system will try adding a .hs suffix, and then a .lhs suffix, and then it will repeat the process for each directory in the path, until either a suitable file has been located, or, otherwise, until all of the possible choices have been tried. For example, this means that you do not have to type the .hs suffix to load a file Demo.hs from the current directory, provided that you do not already have a Demo file in the same directory. In the same way, it is not usually necessary to include the full pathname for one of the standard Hugs libraries. For example, provided that you do not have an Array, Array.hs, or Array.lhs file in the current working directory, you can load the standard Array library by typing just :load Array.