summaryrefslogtreecommitdiff
path: root/compiler/main/InteractiveEval.hs
Commit message (Collapse)AuthorAgeFilesLines
...
* SafeHaskell: Even more fixing to work with safe baseDavid Terei2011-06-171-2/+1
|
* Tidy up the ic_exports field of the InteractiveContext. PreviouslySimon Marlow2011-06-041-31/+13
| | | | | | 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-3/+10
| | | | | | | | | 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.
* Look through type synonyms when computing orphanssimonpj@microsoft.com2011-01-261-1/+1
| | | | | | | | I renamed functions tyClsNamesOfTypes to oprhNamesOfType, because it's only used in that capacity, and we therefore want to look through type synonyms. Similarly exprOrphNames. This fixes Trac #4912.
* Major refactoring of the type inference enginesimonpj@microsoft.com2011-01-121-18/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch embodies many, many changes to the contraint solver, which make it simpler, more robust, and more beautiful. But it has taken me ages to get right. The forcing issue was some obscure programs involving recursive dictionaries, but these eventually led to a massive refactoring sweep. Main changes are: * No more "frozen errors" in the monad. Instead "insoluble constraints" are now part of the WantedConstraints type. * The WantedConstraint type is a product of bags, instead of (as before) a bag of sums. This eliminates a good deal of tagging and untagging. * This same WantedConstraints data type is used - As the way that constraints are gathered - As a field of an implication constraint - As both argument and result of solveWanted - As the argument to reportUnsolved * We do not generate any evidence for Derived constraints. They are purely there to allow "impovement" by unifying unification variables. * In consequence, nothing is ever *rewritten* by a Derived constraint. This removes, by construction, all the horrible potential recursive-dictionary loops that were making us tear our hair out. No more isGoodRecEv search either. Hurrah! * We add the superclass Derived constraints during canonicalisation, after checking for duplicates. So fewer superclass constraints are generated than before. * Skolem tc-tyvars no longer carry SkolemInfo. Instead, the SkolemInfo lives in the GivenLoc of the Implication, where it can be tidied, zonked, and substituted nicely. This alone is a major improvement. * Tidying is improved, so that we tend to get t1, t2, t3, rather than t1, t11, t111, etc Moreover, unification variables are always printed with a digit (thus a0, a1, etc), so that plain 'a' is available for a skolem arising from a type signature etc. In this way, (a) We quietly say which variables are unification variables, for those who know and care (b) Types tend to get printed as the user expects. If he writes f :: a -> a f = ...blah... then types involving 'a' get printed with 'a', rather than some tidied variant. * There are significant improvements in error messages, notably in the "Cannot deduce X from Y" messages.
* Just some alpha renamingIan Lynagh2010-11-211-4/+4
|
* Fix bug #3165 (:history throws irrefutable pattern failed)pepeiborra@gmail.com2010-11-151-21/+12
| | | | | | | | | I ran across this bug and took the time to fix it, closing a long time due TODO in InteractiveEval.hs Instead of looking around to find the enclosing declaration of a tick, this patch makes use of the information already collected during the coverage desugaring phase
* Refactoring and tidyup of HscMain and related things (also fix #1666)Simon Marlow2010-10-271-25/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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))
* Clean up the debugger codesimonpj@microsoft.com2010-10-191-51/+25
| | | | | | In particular there is much less fiddly skolemisation now Things are not *quite* right (break001 and 006 still fail), but they are *much* better than before.
* Add a -fghci-sandbox flag so that we can en/disable the ghci sandboxIan Lynagh2010-10-151-6/+13
| | | | | | | | | | | It's on by default (which matches the previous behaviour). Motivation: GLUT on OS X needs to run on the main thread. If you try to use it from another thread then you just get a white rectangle rendered. For this, or anything else with such restrictions, you can turn the GHCi sandbox off and things will be run in the main thread.
* avoid Foreign.unsafePerformIORoss Paterson2010-09-091-1/+2
|
* Expose the functions haddock needs even when haddock is disabled; #3558Ian Lynagh2010-07-311-9/+0
|
* adapt to the new async exceptions APISimon Marlow2010-07-091-3/+3
|
* trac #2362 (full import syntax in ghci)amsay@amsay.net2010-06-251-20/+35
| | | | 'import' syntax is seperate from ':module' syntax
* Fix Trac #4127: build GlobalRdrEnv in GHCi correctlysimonpj@microsoft.com2010-06-151-19/+15
| | | | | | | GHCi was building its GlobalRdrEnv wrongly, so that the gre_par field was bogus. That in turn fooled the renamer. The fix is easy: use the right function! Namely, call RnNames.gresFromAvail rather than availsToNameSet.
* Use UserInterrupt rather than our own Interrupted exception (#4100)Simon Marlow2010-06-021-2/+2
|
* Remove LazyUniqFM; fixes trac #3880Ian Lynagh2010-03-201-1/+1
|
* Substantial improvements to coercion optimisationsimonpj@microsoft.com2010-01-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The main purpose of this patch is to add a bunch of new rules to the coercion optimiser. They are documented in the (revised) Appendix of the System FC paper. Some code has moved about: - OptCoercion is now a separate module, mainly because it now uses tcMatchTy, which is defined in Unify, so OptCoercion must live higehr up in the hierarchy - Functions that manipulate Kinds has moved from Type.lhs to Coercion.lhs. Reason: the function typeKind now needs to call coercionKind. And in any case, a Kind is a flavour of Type, so it builds on top of Type; indeed Coercions and Kinds are both flavours of Type. This change required fiddling with a number of imports, hence the one-line changes to otherwise-unrelated modules - The representation of CoTyCons in TyCon has changed. Instead of an extensional representation (a kind checker) there is now an intensional representation (namely TyCon.CoTyConDesc). This was needed for one of the new coercion optimisations.
* Make the types we use when creating GHCi bytecode better match realityIan Lynagh2009-07-291-1/+1
| | | | | We were keeping things as Int, and then converting them to Word16 at the last minute, when really they ought to have been Word16 all along.
* Trim unused imports detected by new unused-import codesimonpj@microsoft.com2009-07-061-1/+1
|
* Support for -fwarn-unused-do-bind and -fwarn-wrong-do-bind, as per #3263Max Bolingbroke2009-07-011-1/+1
|
* FIX #2845: Allow breakpoints on expressions with unlifted typeSimon Marlow2009-04-201-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | It turns out we can easily support breakpoints on expressions with unlifted types, by translating case tick# of _ -> e into let f = \s . case tick# of _ -> e in f realWorld# instead of just a plain let-binding. This is the same trick that GHC uses for abstracting join points of unlifted type. In #2845, GHC has eta-expanded the tick expression, changing the result type from IO a to (# State#, a #), which was the reason the tick was suddenly being ignored. By supporting ticks on unlifted expressions we can make it work again, although some confusion might arise because _result will no longer be available (it now has unboxed-tuple type, so we can't bind it in the environment). The underlying problem here is that GHC does transformations like eta-expanding the tick expressions, and there's nothing we can do to prevent that.
* :steplocal and :stepmodule should not polute trace historyPeter Hercek2009-02-221-7/+9
|
* #2973: we should virtualise the CWD inside the GHC API, not in the clientSimon Marlow2009-01-271-0/+25
| | | | | | | The problem is that we install the client's CWD before calling runStmt, but runStmt has to load modules before running the code. We need to install the CWD just before running the code instead, which means it has to be done inside runStmt (and resume).
* validate fix: InteractiveEval no longer needs to import IdInfoIan Lynagh2009-01-031-1/+0
|
* Make record selectors into ordinary functionssimonpj@microsoft.com2009-01-021-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This biggish patch addresses Trac #2670. The main effect is to make record selectors into ordinary functions, whose unfoldings appear in interface files, in contrast to their previous existence as magic "implicit Ids". This means that the usual machinery of optimisation, analysis, and inlining applies to them, which was failing before when the selector was somewhat complicated. (Which it can be when strictness annotations, unboxing annotations, and GADTs are involved.) The change involves the following points * Changes in Var.lhs to the representation of Var. Now a LocalId can have an IdDetails as well as a GlobalId. In particular, the information that an Id is a record selector is kept in the IdDetails. While compiling the current module, the record selector *must* be a LocalId, so that it participates properly in compilation (free variables etc). This led me to change the (hidden) representation of Var, so that there is now only one constructor for Id, not two. * The IdDetails is persisted into interface files, so that an importing module can see which Ids are records selectors. * In TcTyClDecls, we generate the record-selector bindings in renamed, but not typechecked form. In this way, we can get the typechecker to add all the types and so on, which is jolly helpful especially when GADTs or type families are involved. Just like derived instance declarations. This is the big new chunk of 180 lines of code (much of which is commentary). A call to the same function, mkAuxBinds, is needed in TcInstDcls for associated types. * The typechecker therefore has to pin the correct IdDetails on to the record selector, when it typechecks it. There was a neat way to do this, by adding a new sort of signature to HsBinds.Sig, namely IdSig. This contains an Id (with the correct Name, Type, and IdDetails); the type checker uses it as the binder for the final binding. This worked out rather easily. * Record selectors are no longer "implicit ids", which entails changes to IfaceSyn.ifaceDeclSubBndrs HscTypes.implicitTyThings TidyPgm.getImplicitBinds (These three functions must agree.) * MkId.mkRecordSelectorId is deleted entirely, some 300+ lines (incl comments) of very error prone code. Happy days. * A TyCon no longer contains the list of record selectors: algTcSelIds is gone The renamer is unaffected, including the way that import and export of record selectors is handled. Other small things * IfaceSyn.ifaceDeclSubBndrs had a fragile test for whether a data constructor had a wrapper. I've replaced that with an explicit flag in the interface file. More robust I hope. * I renamed isIdVar to isId, which touched a few otherwise-unrelated files.
* Use an extensible-exceptions package when bootstrappingIan Lynagh2008-10-031-22/+2
| | | | | | | Ifdefs for whether we had extensible exceptions or not were spreading through GHC's source, and things would only have got worse for the next 2-3 years, so instead we now use an implementation of extensible exceptions built on top of the old exception type.
* Fix a couple of issues with :printpepe2008-09-181-33/+51
| | | | | | | | | | | | - Ticket #1995: Unsoundness with newtypes - Ticket #2475: "Can't unify" error when stopped at an exception In addition this patch adds the following: - Unfailingness: RTTI cannot panic anymore. In case of failure, it recovers gracefully by returning the "I know nothing" type - A -ddump-rtti flag
* Use 'GhcMonad' in InteractiveEval.Thomas Schilling2008-09-141-169/+166
|
* Document InteractiveEval and follow OccName changeMax Bolingbroke2008-07-311-2/+2
|
* Split the Id related functions out from Var into Id, document Var and some of IdMax Bolingbroke2008-07-311-1/+1
|
* Follow changes in the base libraryIan Lynagh2008-07-311-3/+19
| | | | | TopHandler now uses the new extensible exceptions module, so we need to interact with it using the new types.
* Follow extensible exception changesIan Lynagh2008-07-301-7/+7
|
* Fix Haddock errors.Thomas Schilling2008-07-201-11/+10
|
* Fix buildIan Lynagh2008-04-221-0/+2
|
* (F)SLIT -> (f)sLit in InteractiveEvalIan Lynagh2008-04-121-6/+4
|
* Fix #2044 (:printing impredicatively typed things)pepe2008-04-211-3/+8
| | | | Switching to boxyUnify should be enough to fix this.
* Fix warnings in main/InteractiveEvalIan Lynagh2008-03-251-17/+27
|
* Fix a space leak in :trace (trac #2128)Ian Lynagh2008-03-161-1/+1
| | | | | We were doing lots of cons'ing and tail'ing without forcing the tails, so were building up lots of thunks.
* Convert more UniqFM's back to LazyUniqFM'sIan Lynagh2008-02-071-1/+1
| | | | | | | | | | | | | | | These fix these failures: break008(ghci) break009(ghci) break026(ghci) ghci.prog009(ghci) ghci025(ghci) print007(ghci) prog001(ghci) prog002(ghci) prog003(ghci) at least some of which have this symptom: Exception: expectJust prune
* refactoring onlyPepe Iborra2007-12-021-1/+1
|
* fix race conditions in sandboxIO (#1583, #1922, #1946)Simon Marlow2007-12-041-19/+23
| | | | using the new block-inheriting forkIO (#1048)
* Fix Trac 1865: GHCi debugger crashes with :printPepe Iborra2007-11-131-1/+1
|
* View patterns, record wildcards, and record punsDan Licata2007-10-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements three new features: * view patterns (syntax: expression -> pat in a pattern) * working versions of record wildcards and record puns See the manual for detailed descriptions. Other minor observable changes: * There is a check prohibiting local fixity declarations when the variable being fixed is not defined in the same let * The warn-unused-binds option now reports warnings for do and mdo stmts Implementation notes: * The pattern renamer is now in its own module, RnPat, and the implementation is now in a CPS style so that the correct context is delivered to pattern expressions. * These features required a fairly major upheaval to the renamer. Whereas the old version used to collect up all the bindings from a let (or top-level, or recursive do statement, ...) and put them into scope before renaming anything, the new version does the collection as it renames. This allows us to do the right thing with record wildcard patterns (which need to be expanded to see what names should be collected), and it allows us to implement the desired semantics for view patterns in lets. This change had a bunch of domino effects brought on by fiddling with the top-level renaming. * Prior to this patch, there was a tricky bug in mkRecordSelId in HEAD, which did not maintain the invariant necessary for loadDecl. See note [Tricky iface loop] for details.
* FIX #1681: withBreakAction had too large a scope in runStmtSimon Marlow2007-10-101-4/+4
|
* FIX #1743, create a fresh unique for each Id we bind at a breakpointSimon Marlow2007-10-091-1/+8
|
* Fix type signaturesPepe Iborra2007-09-111-2/+2
|
* GHCi debugger: new flag -fbreak-on-errorPepe Iborra2007-09-111-8/+20
| | | | | This flag works like -fbreak-on-exception, but only stops on uncaught exceptions.
* warning policePepe Iborra2007-09-061-4/+4
|
* FIX #1650: ".boot modules interact badly with the ghci debugger"Simon Marlow2007-09-051-5/+15
| | | | | | | | | | | | | | | | | | | In fact hs-boot files had nothing to do with it: the problem was that GHCi would forget the breakpoint information for a module that had been reloaded but not recompiled. It's amazing that we never noticed this before. The ModBreaks were in the ModDetails, which was the wrong place. When we avoid recompiling a module, ModDetails is regenerated from ModIface by typecheckIface, and at that point it has no idea what the ModBreaks should be, so typecheckIface made it empty. The right place for the ModBreaks to go is with the Linkable, which is retained when compilation is avoided. So now I've placed the ModBreaks in with the CompiledByteCode, which also makes it clear that only byte-code modules have breakpoints. This fixes break022/break023