summaryrefslogtreecommitdiff
path: root/compiler/main/HeaderInfo.hs
Commit message (Collapse)AuthorAgeFilesLines
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-0/+2
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Avoid trivial cases of NondecreasingIndentationHerbert Valerio Riedel2014-05-151-2/+2
| | | | | | | This cleanup allows the following refactoring commit to avoid adding a few `{-# LANGUAGE NondecreasingIndentation #-}` pragmas. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Minor change to error message wordingKrzysztof Gogolewski2013-11-171-1/+1
| | | | One flag is deprecated, other removed
* Whitespace only in HeaderInfoIan Lynagh2013-06-221-34/+27
|
* Some alpha renamingIan Lynagh2012-10-161-1/+1
| | | | | Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
* Pass DynFlags down to mk_err_msgIan Lynagh2012-06-121-25/+27
|
* fix quadratic performance issue with long module names (#5981)Simon Marlow2012-04-111-11/+15
|
* Implememt -fdefer-type-errors (Trac #5624)Simon Peyton Jones2012-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the idea of deferring (most) type errors to runtime, instead emitting only a warning at compile time. The basic idea is very simple: * The on-the-fly unifier in TcUnify never fails; instead if it gets stuck it emits a constraint. * The constraint solver tries to solve the constraints (and is entirely unchanged, hooray). * The remaining, unsolved constraints (if any) are passed to TcErrors.reportUnsolved. With -fdefer-type-errors, instead of emitting an error message, TcErrors emits a warning, AND emits a binding for the constraint witness, binding it to (error "the error message"), via the new form of evidence TcEvidence.EvDelayedError. So, when the program is run, when (and only when) that witness is needed, the program will crash with the exact same error message that would have been given at compile time. Simple really. But, needless to say, the exercise forced me into some major refactoring. * TcErrors is almost entirely rewritten * EvVarX and WantedEvVar have gone away entirely * ErrUtils is changed a bit: * New Severity field in ErrMsg * Renamed the type Message to MsgDoc (this change touches a lot of files trivially) * One minor change is that in the constraint solver we try NOT to combine insoluble constraints, like Int~Bool, else all such type errors get combined together and result in only one error message! * I moved some definitions from TcSMonad to TcRnTypes, where they seem to belong more
* Fix parsing of OPTIONS*/LANGUAGE pragmas in haddock modeIan Lynagh2011-11-301-4/+10
| | | | | | | | | | | | | | | | | When getting options from basicTypes/RdrName.lhs, we were seeing text like "-- |\n-- ...\n" in the buffer, and lexer then recognises "-- |\n-- ..." as a complete ITdocCommentNext token, with the end of the buffer not reached. Next time round, when we get more input into the buffer, it started "\n-- * 'Var.Var': see", so the lexer gave us an ITdocSection token. However, getOptions' only knew about ITdocCommentNext, and so it stopped at that point, and didn't see the pragmas further down the file. This caused the build to fail due to -fwarn-tabs not being turned off. But actually, we don't really want the haddock docs at this point, so now we just unset Opt_Haddock in getOptionsFromFile.
* 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.
* Refactor the imports of InteractiveContextSimon Peyton Jones2011-08-021-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Give a more helpful src location (Trac #5281)Simon Peyton Jones2011-07-271-7/+7
| | | | | | We weren't giving a useful location for the *implicit* import of Prelude. Lennart rightly complained. This fixes it.
* SafeHaskell: Disable certain ghc extensions in Safe.David Terei2011-06-171-7/+7
| | | | | | | | | | 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.
* SafeHaskell: Add safe import flag (not functional)David Terei2011-06-171-1/+2
|
* Refactor SrcLoc and SrcSpanIan Lynagh2011-06-091-5/+5
| | | | | | | | | | | | | | | 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.
* Implement fuzzy matching for the Findersimonpj@microsoft.com2010-12-221-1/+2
| | | | | | | | | ..so that you get a more helpful message when you mis-spell a module name in an 'import'. Validates, but not fully tested. Based on Max's patch in Trac #2442, but heavily refactored.
* Refactoring and tidyup of HscMain and related things (also fix #1666)Simon Marlow2010-10-271-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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))
* Change "OPTIONS" to "OPTIONS_GHC" in error messages; fixes #4327Ian Lynagh2010-09-241-2/+2
|
* Add separate functions for querying DynFlag and ExtensionFlag optionsIan Lynagh2010-09-181-1/+1
| | | | and remove the temporary DOpt class workaround.
* Add support for Haskell98 and Haskell2010 "languages"Ian Lynagh2010-07-241-2/+2
|
* Rename "language" varibles etc to "extension", and add --supported-extensionsIan Lynagh2010-07-241-2/+2
|
* Handle haddock headers when looking for LANGUAGE/OPTIONS_GHC pragmasIan Lynagh2010-07-071-0/+3
|
* Make mkPState and pragState take their arguments in the same orderIan Lynagh2010-07-061-1/+1
|
* Spelling correction for LANGUAGE pragmasMax Bolingbroke2010-04-131-2/+3
|
* Add the implicit 'import Prelude' in getImportsSimon Marlow2010-03-031-6/+41
| | | | | This makes things more consistent, and avoids a strange "Prelude is not loaded" error when there is a Prelude.hs on the search path.
* Columns now start at 1, as lines already didIan Lynagh2009-11-271-4/+4
| | | | Also corrected a couple of line 0's to line 1
* Improve error message for malformed LANGUAGE pragmasimonpj@microsoft.com2009-10-301-2/+5
|
* remove Haddock-lexing/parsing/renaming from GHCIsaac Dupree2009-08-261-1/+1
|
* Fix error handlingIan Lynagh2009-04-281-1/+2
| | | | | After the fix to #2500, we could get "Failing due to -Werror." but no warnings printed. Now we don't fail in that case.
* FIX #2500: Don't log warnings in getHeaderSimon Marlow2009-04-211-2/+4
|
* FIX #3153: we lost an EOF sentinel in the event of a lexical errorSimon Marlow2009-04-211-2/+3
|
* FIX #3079, dodgy parsing of LANGUAGE pragmas2009-03-13Simon Marlow2009-03-121-57/+71
| | | | | | | | | I ended up rewriting this horrible bit of code, using (yikes) lazy I/O to slurp in the source file a chunk at a time. The old code tried to read the file a chunk at a time, but failed with LANGUAGE pragmas because the parser for LANGUAGE has state and the state wasn't being saved between chunks. We're still closing the Handle eagerly, so there shouldn't be any problems here.
* Put full ImportDecls in ModSummary instead of just ModuleNamesSimon Marlow2008-12-021-18/+6
| | | | | | | | ... and use it to make ghc -M generate correct cross-package dependencies when using package-qualified imports (needed for the new build system). Since we're already parsing the ImportDecl from the source file, there seems no good reason not to keep it in the ModSummary, it might be useful for other things too.
* Document exported functions in main/HeaderInfo.Thomas Schilling2008-11-211-5/+16
|
* Remove warning supression klugde in main/HeaderInfoThomas Schilling2008-11-211-8/+4
|
* Throw SourceErrors instead of ProgramErrors in main/HeaderInfo.Thomas Schilling2008-11-211-23/+36
| | | | | Parse errors during dependency analysis or options parsing really shouldn't kill GHC; this is particularly annoying for GHC API clients.
* fix #2636: throw missing module errors as SourceErrors, not ErrMsgSimon Marlow2008-10-101-2/+3
|
* Give locations of flag warnings/errorsIan Lynagh2008-08-261-7/+8
|
* Add -XPackageImports, new syntax for package-qualified importsSimon Marlow2008-08-051-4/+10
| | | | | | | | | | | | | | | | | Now you can say import "network" Network.Socket and get Network.Socket from package "network", even if there are multiple Network.Socket modules in scope from different packages and/or the current package. This is not really intended for general use, it's mainly so that we can build backwards-compatible versions of packages, where we need to be able to do module GHC.Base (module New.GHC.Base) where import "base" GHC.Base as New.GHC.Base
* Follow changes in the base libraryIan Lynagh2008-07-311-1/+1
| | | | | 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-3/+3
|
* Remove code that isn't used now that we assume that GHC >= 6.4Ian Lynagh2008-06-201-11/+0
|
* Handle errors in an OPTIONS pragma when preprocessingIan Lynagh2008-06-141-1/+15
|
* Pass dynflags down through to pragStateIan Lynagh2008-06-141-9/+11
| | | | so we no longer need to use defaultDynFlags there
* Improve error message for malformed LANGUAGE pragmaTim Chevalier2008-04-061-2/+3
| | | | | | I made the error (which previously said "cannot parse LANGUAGE pragma") slightly more helpful by reminding the user that pragmas should be comma-separated.
* Fixed warnings in main/HeaderInfo, except for incomplete pattern matchesTwan van Laarhoven2008-01-271-10/+15
|
* lots of portability changes (#1405)Isaac Dupree2008-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-recording to avoid new conflicts was too hard, so I just put it all in one big patch :-( (besides, some of the changes depended on each other.) Here are what the component patches were: Fri Dec 28 11:02:55 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org> * document BreakArray better Fri Dec 28 11:39:22 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org> * properly ifdef BreakArray for GHCI Fri Jan 4 13:50:41 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * change ifs on __GLASGOW_HASKELL__ to account for... (#1405) for it not being defined. I assume it being undefined implies a compiler with relatively modern libraries but without most unportable glasgow extensions. Fri Jan 4 14:21:21 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * MyEither-->EitherString to allow Haskell98 instance Fri Jan 4 16:13:29 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * re-portabilize Pretty, and corresponding changes Fri Jan 4 17:19:55 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * Augment FastTypes to be much more complete Fri Jan 4 20:14:19 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * use FastFunctions, cleanup FastString slightly Fri Jan 4 21:00:22 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * Massive de-"#", mostly Int# --> FastInt (#1405) Fri Jan 4 21:02:49 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * miscellaneous unnecessary-extension-removal Sat Jan 5 19:30:13 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * add FastFunctions
* Refactor Haddock optionsDavid Waern2007-11-011-1/+10
| | | | | | | | | | | | | | This patch renames the DOC_OPTIONS pragma to OPTIONS_HADDOCK. It also adds "-- # ..."-style Haddock option pragmas, for compatibility with code that use them. Another change is that both of these two pragmas behave like OPTIONS_GHC, i.e. they are only allowed at the top of the module, they are ignored everywhere else and they are stored in the dynflags. There is no longer any Haddock options in HsSyn. Please merge this to the 6.8.2 branch when 6.8.1 is out, if appropriate.
* Move OPTIONS pragmas above commentsIan Lynagh2007-09-211-7/+7
| | | | Fixes building with -Werror (i.e. validate) and GHC < 6.6