• Simon Marlow's avatar
    Clean up the handling of the import and :module commands in GHCi · 79d6745f
    Simon Marlow authored
    Previously we remembered the whole history of commands and replayed
    them on every :load/:reload, which lead to some non-linear performance
    characteristics (#5317).  The handling of the implicit Prelude import
    and the implicit imports of recently loaded modules was also
    complicated and wrong in various obscure ways.
    
    The Prelude import works just like the implicit Prelude import in a
    Haskell module: it can be overriden with an explicit Prelude
    import.
    
    I have added a new ":show imports" command to show which imports are
    currently in force.
    
    Prelude> :show imports
    import Prelude -- implicit
    Prelude> import Prelude ()
    Prelude> :show imports
    import Prelude ()
    Prelude> map
    
    <interactive>:0:1: Not in scope: `map'
    Prelude>
    
    Full documentation in the User's Guide.
    
    There are various other little tweaks and improvements, such as when a
    module is imported with 'as', we now show the 'as' name in the prompt
    rather than the original name.
    79d6745f
GhciMonad.hs 12.1 KB