summaryrefslogtreecommitdiff
path: root/ghc/GhciMonad.hs
Commit message (Collapse)AuthorAgeFilesLines
* MRP-refactor `GHCi` Applicative/Monad instanceHerbert Valerio Riedel2015-10-181-2/+1
| | | | | As GHCi is compiled by stage1+ GHC only, we can drop the explicit `return` definition rightaway.
* More accurate allocation stats for :set +sSimon Marlow2015-05-111-18/+19
| | | | | | | | | | | | | | | The point of this commit is to make the memory allocation statistic from :set +s in GHCi a lot more accurate. Currently it uses the total allocation figure calculated by the RTS, which is only updated during GC, so can be wrong by an arbitrary amount. The fix is to the the per-thread allocation counter that was introduced for allocation limits. This required changes to the GHC API, because we now have to return the allocation value from each evaluation. Rather than just change the API, I introduced a new API and deprecated the old one. The new one is simpler and more extensible, so hopefully we won't need to make this transition in the future. See GHC.hs for details.
* fix typoJavran Cheng2015-04-061-1/+1
| | | | | | [skip ci] Differential Revision: https://phabricator.haskell.org/D812
* Make ghc -e fail on invalid declarationsReid Barton2014-12-231-3/+5
| | | | | | | | | | | | | | | | | Summary: Note: This commit includes an API change to GhciMonad.runDecls to allow the caller to determine whether the declarations were run successfully or not. Test Plan: harbormaster Reviewers: austin Reviewed By: austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D582
* Make ghc -e not exit on valid import commands (#9905)Reid Barton2014-12-231-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Some Trues and Falses were mixed up due to Bool being used in different senses in different parts of GHCi. Test Plan: harbormaster; validate Reviewers: austin Reviewed By: austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D581 GHC Trac Issues: #9905 Conflicts: ghc/InteractiveUI.hs
* Revert "Rename _closure to _static_closure, apply naming consistently."Edward Z. Yang2014-10-201-3/+3
| | | | | | | This reverts commit 35672072b4091d6f0031417bc160c568f22d0469. Conflicts: compiler/main/DriverPipeline.hs
* Rename _closure to _static_closure, apply naming consistently.Edward Z. Yang2014-10-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In preparation for indirecting all references to closures, we rename _closure to _static_closure to ensure any old code will get an undefined symbol error. In order to reference a closure foobar_closure (which is now undefined), you should instead use STATIC_CLOSURE(foobar). For convenience, a number of these old identifiers are macro'd. Across C-- and C (Windows and otherwise), there were differing conventions on whether or not foobar_closure or &foobar_closure was the address of the closure. Now, all foobar_closure references are addresses, and no & is necessary. CHARLIKE/INTLIKE were not changed, simply alpha-renamed. Part of remove HEAP_ALLOCED patch set (#8199) Depends on D265 Signed-off-by: Edward Z. Yang <ezyang@mit.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D267 GHC Trac Issues: #8199
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-2/+5
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* Fixes #95 :edit command should jump to the last errorLorenzo Tabacchini2014-06-131-1/+3
|
* Convert `ghc-bin.cabal` to use others-extensionsHerbert Valerio Riedel2014-05-151-0/+1
| | | | | | | This replaces the previous `default-extensions` by per-file declared `{-# LANGUAGE ... #-}` pragmas. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Separate thousands when printing allocated bytesErlend Hamberg2014-04-211-1/+6
| | | | | | | | 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>
* Fix AMP warnings.Austin Seipp2013-09-111-3/+8
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add the ability to customize the continuation prompt.usrbincc2013-06-041-1/+1
| | | | - Remove unused property `def_prompt`.
* Remove gblock and gunblockIan Lynagh2013-02-191-5/+0
|
* Ship transformers with GHCIan Lynagh2013-01-021-16/+6
| | | | | This means that we can use the standard MonadIO class, rather than needing our own copy.
* Make a little more of the GHCi internal API configurableDavid Terei2012-07-101-1/+8
|
* Fix ghc/ following -dppr-user-length changesIan Lynagh2012-06-141-2/+1
|
* Pass DynFlags down to showSDocIan Lynagh2012-06-121-4/+5
|
* Build fixesIan Lynagh2012-06-121-2/+4
|
* Updates for haskeline-0.7's new MonadException API.Judah Jacobson2012-05-261-8/+12
|
* Use transformers directly, rather than using mtlIan Lynagh2012-05-191-1/+2
| | | | This means we no longer need mtl in a GHC tree.
* GHCi: add :seti, for options that apply only at the prompt (#3217)Simon Marlow2012-03-011-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove unused ghciHandleGhcExceptionIan Lynagh2012-02-161-5/+0
|
* Fix warning in GhciMonad.David Terei2012-01-261-1/+2
|
* Improve source code documentation og GHCi main.David Terei2012-01-251-1/+15
|
* Tabs -> SpacesDavid Terei2011-12-191-43/+37
|
* Add a class HasDynFlags(getDynFlags)Ian Lynagh2011-12-191-4/+6
| | | | | | | | 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.
* 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.
* Follow changes to HValue/Any handlingIan Lynagh2011-10-031-1/+1
| | | | | 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.
* Add support for all top-level declarations to GHCiSimon Marlow2011-09-211-4/+15
| | | | | | | | | | | | | | | | 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.
* Clean up the handling of the import and :module commands in GHCiSimon Marlow2011-08-261-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Tidy up the ic_exports field of the InteractiveContext. PreviouslySimon Marlow2011-06-041-3/+3
| | | | | | 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.
* :script file scripts in GHCi #1363Vivian McPhail2011-02-261-1/+2
| | | | | | | | | 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.
* multiline commands in GHCi #4316Vivian McPhail2010-11-051-0/+1
| | | | | | | | | | | | | 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`
* Comments onlysimonpj@microsoft.com2010-12-241-1/+2
|
* Use liftIO rather than ioIan Lynagh2010-11-031-9/+6
|
* Refactoring and tidyup of HscMain and related things (also fix #1666)Simon Marlow2010-10-271-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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))
* adapt to the new async exceptions APISimon Marlow2010-07-091-3/+12
|
* refactor import declaration support (#2362)Simon Marlow2010-07-051-8/+5
|
* trac #2362 (full import syntax in ghci)amsay@amsay.net2010-06-251-1/+5
| | | | 'import' syntax is seperate from ':module' syntax
* GhciMonad.resume should restore the program's argv and prognameSimon Marlow2009-10-211-1/+7
| | | | | | | | 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.
* remove encoding of output using Haskeline; the IO library does it now (#3398)Simon Marlow2009-09-181-32/+2
|
* Trim unused imports detected by new unused-import codesimonpj@microsoft.com2009-07-061-3/+3
|
* Support for -fwarn-unused-do-bind and -fwarn-wrong-do-bind, as per #3263Max Bolingbroke2009-07-011-4/+3
|
* Changes for the new IO library, mainly base-package modules moving aroundSimon Marlow2009-05-291-3/+3
|
* Use haskeline, rather than editline, for line editing in ghciIan Lynagh2009-04-291-0/+389