summaryrefslogtreecommitdiff
path: root/ghc/InteractiveUI.hs
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactoring: make IIModule contain ModuleName, not Module, for consistencySimon Marlow2012-02-141-73/+81
|
* Refactoring, and fix a couple of SafeHaskell-related thingsSimon Marlow2012-02-141-33/+58
| | | | | | | | | When -XSafe is on: - ":load M" should default to adding M to the context (rather than *M). - "import M" should do the appropriate trust check Also various refactoring and comments added, hopefully the code is easier to read now.
* Revert "Don't add a bad import to the saved context."Simon Marlow2012-02-131-28/+17
| | | | | | | This reverts commit e5272d9bf2a65b7da8364803fcafbd2012b7de97. Reverting to fix validate regression, and pending a redesign of the changes.
* Revert "Have :load work under -XSafe in GHCi."Simon Marlow2012-02-131-10/+6
| | | | | | | This reverts commit 5e9e07a33e17da01245f0cea78e6a6f8a32ac77d. Reverting to fix validate regression, and pending a redesign of the changes.
* Have :load work under -XSafe in GHCi.David Terei2012-02-101-6/+10
|
* Don't add a bad import to the saved context.David Terei2012-02-101-17/+28
| | | | | | Importing an unsafe module in GHCi under -XSafe would fail but still save that in the context so it would be retried on every subsequent import.
* Check that imported modules actually exist (#5836)Simon Marlow2012-02-071-0/+1
|
* Improve source code documentation og GHCi main.David Terei2012-01-251-3/+22
|
* Add a missing newline in the ghci :h text; spotted by Alexander McPhailIan Lynagh2012-01-241-1/+1
|
* Fix minor bug introduced in e7e771d14ac671904a69abecf9e133d4647026c1Simon Marlow2012-01-031-1/+1
|
* Major refactoring of CoAxiomsSimon Peyton Jones2012-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch should have no user-visible effect. It implements a significant internal refactoring of the way that FC axioms are handled. The ultimate goal is to put us in a position to implement "pattern-matching axioms". But the changes here are only does refactoring; there is no change in functionality. Specifically: * We now treat data/type family instance declarations very, very similarly to types class instance declarations: - Renamed InstEnv.Instance as InstEnv.ClsInst, for symmetry with FamInstEnv.FamInst. This change does affect the GHC API, but for the better I think. - Previously, each family type/data instance declaration gave rise to a *TyCon*; typechecking a type/data instance decl produced that TyCon. Now, each type/data instance gives rise to a *FamInst*, by direct analogy with each class instance declaration giving rise to a ClsInst. - Just as each ClsInst contains its evidence, a DFunId, so each FamInst contains its evidence, a CoAxiom. See Note [FamInsts and CoAxioms] in FamInstEnv. The CoAxiom is a System-FC thing, and can relate any two types, whereas the FamInst relates directly to the Haskell source language construct, and always has a function (F tys) on the LHS. - Just as a DFunId has its own declaration in an interface file, so now do CoAxioms (see IfaceSyn.IfaceAxiom). These changes give rise to almost all the refactoring. * We used to have a hack whereby a type family instance produced a dummy type synonym, thus type instance F Int = Bool -> Bool translated to axiom FInt :: F Int ~ R:FInt type R:FInt = Bool -> Bool This was always a hack, and now it's gone. Instead the type instance declaration produces a FamInst, whose axiom has kind axiom FInt :: F Int ~ Bool -> Bool just as you'd expect. * Newtypes are done just as before; they generate a CoAxiom. These CoAxioms are "implicit" (do not generate an IfaceAxiom declaration), unlike the ones coming from family instance declarations. See Note [Implicit axioms] in TyCon On the whole the code gets significantly nicer. There were consequential tidy-ups in the vectoriser, but I think I got them right.
* Fix :issafe safe haskell ghci commandDavid Terei2011-12-221-8/+24
|
* Fix safe imports to work in GHCi.David Terei2011-12-221-6/+17
|
* simplify code.David Terei2011-12-221-2/+3
|
* Fix warningsDavid Terei2011-12-191-362/+360
|
* Tabs -> SpacesDavid Terei2011-12-191-58/+51
|
* Use -fwarn-tabs when validatingIan Lynagh2011-11-041-0/+7
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* Increment the line number correctly in GHCiSimon Marlow2011-10-241-13/+15
| | | | | | We were doing this when stdin was not a terminal, so all the tests worked, but not when stdin was a terminal. In fact the line number was stuck at "2".
* Remove cruft code from old Safe Haskell implementation methodDavid Terei2011-10-171-4/+4
|
* Allow foreign import declarations to the entered interactively in GHCi.Simon Marlow2011-10-061-1/+2
|
* Implement GHCi command :kind! which normalises its typeSimon Peyton Jones2011-09-231-6/+9
| | | | | | | | | | | | | | | | type family F a type instance F Int = Bool type instance F Bool = Char In GHCi *TF> :kind (F Int, F Bool) (F Int, F Bool) :: * *TF> :kind! F Int (F Int, F Bool) :: * = (Bool, Char) We could call it ":normalise" but it seemed quite nice to have an eager version of :kind
* show bindings in the order they were definedSimon Marlow2011-09-211-3/+2
|
* Add support for all top-level declarations to GHCiSimon Marlow2011-09-211-26/+52
| | | | | | | | | | | | | | | | This is work mostly done by Daniel Winograd-Cort during his internship at MSR Cambridge, with some further refactoring by me. This commit adds support to GHCi for most top-level declarations that can be used in Haskell source files. Class, data, newtype, type, instance are all supported, as are Type Family-related declarations. The current set of declarations are shown by :show bindings. As with variable bindings, entities bound by newer declarations shadow earlier ones. Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054. Documentation to follow.
* In :load, call GHC.guessTarget on the new targets before unloadingSimon Marlow2011-09-211-6/+6
| | | | | | | | Fixes this problem: Prelude> :l foo target `foo' is not a module name or a source file >
* Add a flag -fno-ghci-historyIan Lynagh2011-09-011-2/+5
| | | | | Allows you to turn off loading/storing the GHCi command history from/to the ~/.ghc/ghci_history file.
* fix warningSimon Marlow2011-08-261-1/+1
|
* Clean up the handling of the import and :module commands in GHCiSimon Marlow2011-08-261-310/+423
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* In :browse, always print output in the *current* contextSimon Peyton Jones2011-08-221-19/+11
| | | | | | | | | | | | Previously :browse M (without !) printed output relative to a context that was neither the current one, nor the top-level context of M, but rather that established by import Prelude import M This was pretty confusing, so Simon and I agreed to use a simple, uniform rule: output in GHC is always relative to the current context.
* Formatting fixesDavid Terei2011-08-191-152/+138
|
* Change use of if to whenDavid Terei2011-08-191-5/+4
|
* More info from :issafe ghci commandDavid Terei2011-08-191-24/+41
|
* Wibble to main "Refactor the imports of InteractiveContext" patchSimon Peyton Jones2011-08-021-9/+17
|
* Refactor the imports of InteractiveContextSimon Peyton Jones2011-08-021-94/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of two fields ic_toplev_scope :: [Module] ic_imports :: [ImportDecl RdrName] we now just have one ic_imports :: [InteractiveImport] with the auxiliary data type data InteractiveImport = IIDecl (ImportDecl RdrName) -- Bring the exports of a particular module -- (filtered by an import decl) into scope | IIModule Module -- Bring into scope the entire top-level envt of -- of this module, including the things imported -- into it. This makes lots of code less confusing. No change in behaviour. It's preparatory to fixing Trac #5147. While I was at I also * Cleaned up the handling of the "implicit" Prelude import by adding a ideclImplicit field to ImportDecl. This significantly reduces plumbing in the handling of the implicit Prelude import * Used record notation consistently for ImportDecl
* show warning flags in :set (lost in the recent dopt->wopt change,Simon Marlow2011-07-211-6/+18
| | | | noticed by test ghci024)
* Debugger commands do not work with -fno-ghci-sandbox, so emit usefulSimon Marlow2011-07-121-31/+46
| | | | error messages.
* SafeHaskell: Try to be consistent in naming.David Terei2011-06-291-1/+1
|
* trac #5265 (support for additional .ghci files)Sam Anklesaria2011-06-261-1/+2
|
* SafeHaskell: Change SafeHaskellMode to use Outputable vs ShowDavid Terei2011-06-171-1/+1
|
* SafeHaskell: Fix validation errors when unsafe base usedDavid Terei2011-06-171-2/+5
|
* SafeHaskell: Even more fixing to work with safe baseDavid Terei2011-06-171-0/+1
|
* SafeHaskell: Add ':issafe' cmd to GHCi that displays module safety infoDavid Terei2011-06-171-1/+48
|
* SafeHaskell: Fix a warning stopping validationDavid Terei2011-06-171-3/+5
|
* SafeHaskell: Disable certain ghc extensions in Safe.David Terei2011-06-171-3/+3
| | | | | | | | | | This patch disables the use of some GHC extensions in Safe mode and also the use of certain flags. Some are disabled completely while others are only allowed on the command line and not in source PRAGMAS. We also check that Safe imports are indeed importing a Safe or Trustworthy module.
* Refactor SrcLoc and SrcSpanIan Lynagh2011-06-091-31/+47
| | | | | | | | | | | | | | | The "Unhelpful" cases are now in a separate type. This allows us to improve various things, e.g.: * Most of the panic's in SrcLoc are now gone * The Lexer now works with RealSrcSpans rather than SrcSpans, i.e. it knows that it has real locations and thus can assume that the line number etc really exists * Some of the more suspicious cases are no longer necessary, e.g. we no longer need this case in advanceSrcLoc: advanceSrcLoc loc _ = loc -- Better than nothing More improvements can probably be made, e.g. tick locations can probably use RealSrcSpans too.
* Tidy up the ic_exports field of the InteractiveContext. PreviouslySimon Marlow2011-06-041-49/+80
| | | | | | was [(Module, Maybe ImportDecl)], now it is just [ImportDecl]. So now ":m +A" and "import A" do exactly the same thing in GHCi, and use the same code paths.
* Start support for coloured SDoc output.Thomas Schilling2011-04-071-1/+1
| | | | | | | The SDoc type now passes around an abstract SDocContext rather than just a PprStyle which required touching a few more files. This should also make it easier to integrate DynFlags passing, so that we can get rid of global variables.
* Prefer builtin commands to macros in GHCi command resolution (#3858)Max Bolingbroke2011-04-021-1/+4
| | | | | | | | | | | | | | | | | Current precedence rules in GHCi are that: * User macros are *always* preferred in command resolution * User macros that are defined earlier are preferred to those that are defined earlier on * Builtin commands have lowest precedence However this caused user confusion because e.g. defining a macro beginning with "i" would override the standard :info command whenever the user typed the abbreviated command :i. The new precedence rules are based on the view that things defined earlier are always preferred to things defined later. The builtin commands are logically defined earliest of all (when GHCi starts) so they always take precedence.
* Improve GHCi line numbers in errorsIan Lynagh2011-02-271-6/+9
| | | | | When running commands from the user (as opposed to from a file), reset the line number to 1 at the start of each command.
* :script file scripts in GHCi #1363Vivian McPhail2011-02-261-7/+52
| | | | | | | | | This patch adds the script command in GHCi A file is read and executed as a series of GHCi commands. Execution terminates on the first error. The filename and line number are included in the error.
* Remove redundant importIan Lynagh2011-01-081-1/+0
|