| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
This reverts commit e5272d9bf2a65b7da8364803fcafbd2012b7de97.
Reverting to fix validate regression, and pending a redesign of the
changes.
|
|
|
|
|
|
|
| |
This reverts commit 5e9e07a33e17da01245f0cea78e6a6f8a32ac77d.
Reverting to fix validate regression, and pending a redesign of the
changes.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.
|
|
|
|
|
|
| |
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".
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
Fixes this problem:
Prelude> :l foo
target `foo' is not a module name or a source file
>
|
|
|
|
|
| |
Allows you to turn off loading/storing the GHCi command history from/to
the ~/.ghc/ghci_history file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
noticed by test ghci024)
|
|
|
|
| |
error messages.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
When running commands from the user (as opposed to from a file), reset
the line number to 1 at the start of each command.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|