
#8622: Importing modules in .ghci file doesn't not work ----------------------------------+--------------------------------- Reporter: m4dc4p | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.3 Keywords: | Operating System: MacOS X Architecture: x86_64 (amd64) | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------------+--------------------------------- When attempting to import a module in the .ghci file, GHCi does not seem to use the search path. Define a module names "Macros.hs": {{{ module Macros where hello :: String -> IO String hello msg = return ("putStrLn " ++ show msg) }}} Now, in the same directory, create a .ghci file: {{{ import Macros :def hello hello }}} Run GHCi from that same directory, and you get an error: {{{ $ ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. <no location info>: Could not find module `Macros' It is not a module in the current program, or in any known package. <interactive>:1:25: Not in scope: `hello' }}} It seems that GHCi should be able to find "Macros.hs", compile it, and all me to use it in defining macros. Adding the current directory (relative or absolute) to the search path (using -i) doesn't help. Why do I want to do this? I want to define GHCi macros in a separate module (that is not related to my program) and import them, rather than defining them directly in the .ghci file. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8622 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler