| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
This replaces the previous `default-extensions` by per-file declared
`{-# LANGUAGE ... #-}` pragmas.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
| |
When printing allocated bytes (`:set +s` in ghci), separate thousands
to make it easier to read large allocations sizes, e.g. “1,200,000
bytes”.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
| |
Authored-by: David Luposchainsky <dluposchainsky@gmail.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
- Remove unused property `def_prompt`.
|
| |
|
|
|
|
|
| |
This means that we can use the standard MonadIO class, rather than
needing our own copy.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This means we no longer need mtl in a GHC tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GHCi now maintains two DynFlags: one that applies to whole modules
loaded with :load, and one that applies to things typed at the prompt
(expressions, statements, declarations, commands).
The :set command modifies both DynFlags. This is for backwards
compatibility: users won't notice any difference.
The :seti command applies only to the interactive DynFlags.
Additionally, I made a few changes to ":set" (with no arguments):
* Now it only prints out options that differ from the defaults,
rather than the whole list.
* There is a new variant, ":set -a" to print out all options (the
old behaviour).
* It also prints out language options.
e.g.
Prelude> :set
options currently set: none.
base language is: Haskell2010
with the following modifiers:
-XNoDatatypeContexts
-XNondecreasingIndentation
GHCi-specific dynamic flag settings:
other dynamic, non-language, flag settings:
-fimplicit-import-qualified
warning settings:
":seti" (with no arguments) does the same as ":set", but for the
interactive options. It also has the "-a" option.
The interactive DynFlags are kept in the InteractiveContext, and
copied into the HscEnv at the appropriate points (all in HscMain).
There are some new GHC API operations:
-- | Set the 'DynFlags' used to evaluate interactive expressions.
setInteractiveDynFlags :: GhcMonad m => DynFlags -> m ()
-- | Get the 'DynFlags' used to evaluate interactive expressions.
getInteractiveDynFlags :: GhcMonad m => m DynFlags
-- | Sets the program 'DynFlags'.
setProgramDynFlags :: GhcMonad m => DynFlags -> m [PackageId]
-- | Returns the program 'DynFlags'.
getProgramDynFlags :: GhcMonad m => m DynFlags
Note I have not completed the whole of the plan outlined in #3217 yet:
when in the context of a loaded module we don't take the interactive
DynFlags from that module. That needs some more refactoring and
thinking about, because we'll need to save and restore the original
interactive DynFlags.
This solves the immediate problem that people are having with the new
flag checking in 7.4.1, because now it is possible to set language
options in ~/.ghci that do not affect loaded modules and thereby cause
recompilation.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
We no longer have many separate, clashing getDynFlags functions
I've given each GhcMonad its own HasDynFlags instance, rather than
using UndecidableInstances to make a GhcMonad m => HasDynFlags m
instance.
|
|
|
|
|
| |
We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.
|
|
|
|
|
| |
Also removed the type argument to Any in primops.txt.pp. I don't
see why we need it, and it now breaks haddocking GHC.Prim.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds support for multiline commands in GHCi.
The first line of input is lexed. If there is an active
layout context once the lexer reaches the end of file, the
user is prompted for more input.
Multiline input is exited by an empty line and can be escaped
with a user interrupt.
Multiline mode is toggled with `:set +m`
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While trying to fix #1666 (-Werror aborts too early) I decided to some
tidyup in GHC/DriverPipeline/HscMain.
- The GhcMonad overloading is gone from DriverPipeline and HscMain
now. GhcMonad is now defined in a module of its own, and only
used in the top-level GHC layer. DriverPipeline and HscMain
use the plain IO monad and take HscEnv as an argument.
- WarnLogMonad is gone. printExceptionAndWarnings is now called
printException (the old name is deprecated). Session no longer
contains warnings.
- HscMain has its own little monad that collects warnings, and also
plumbs HscEnv around. The idea here is that warnings are collected
while we're in HscMain, but on exit from HscMain (any function) we
check for warnings and either print them (via log_action, so IDEs
can still override the printing), or turn them into an error if
-Werror is on.
- GhcApiCallbacks is gone, along with GHC.loadWithLogger. Thomas
Schilling told me he wasn't using these, and I don't see a good
reason to have them.
- there's a new pure API to the parser (suggestion from Neil Mitchell):
parser :: String
-> DynFlags
-> FilePath
-> Either ErrorMessages (WarningMessages,
Located (HsModule RdrName))
|
| |
|
| |
|
|
|
|
| |
'import' syntax is seperate from ':module' syntax
|
|
|
|
|
|
|
|
| |
I discovered that single-stepping over getArgs gave the wrong answer
sometimes, because we were forgetting to set the program's argv and
progname when resuming at a breakpoint.
Test is ghci.debugger/scripts/getargs.script.
|
| |
|
| |
|
| |
|
| |
|
|
|