summaryrefslogtreecommitdiff
path: root/docs/users_guide
Commit message (Collapse)AuthorAgeFilesLines
* Desugar RecordUpd in `tcExpr`wip/T18802CarrieMY2022-05-251-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch typechecks record updates by desugaring them inside the typechecker using the HsExpansion mechanism, and then typechecking this desugared result. Example: data T p q = T1 { x :: Int, y :: Bool, z :: Char } | T2 { v :: Char } | T3 { x :: Int } | T4 { p :: Float, y :: Bool, x :: Int } | T5 The record update `e { x=e1, y=e2 }` desugars as follows e { x=e1, y=e2 } ===> let { x' = e1; y' = e2 } in case e of T1 _ _ z -> T1 x' y' z T4 p _ _ -> T4 p y' x' The desugared expression is put into an HsExpansion, and we typecheck that. The full details are given in Note [Record Updates] in GHC.Tc.Gen.Expr. Fixes #2595 #3632 #10808 #10856 #16501 #18311 #18802 #21158 #21289 Updates haddock submodule
* Change `Backend` type and remove direct dependencieswip/backend-as-recordNorman Ramsey2022-05-211-0/+113
| | | | | | | | | | | | | | | | | | | With this change, `Backend` becomes an abstract type (there are no more exposed value constructors). Decisions that were formerly made by asking "is the current back end equal to (or different from) this named value constructor?" are now made by interrogating the back end about its properties, which are functions exported by `GHC.Driver.Backend`. There is a description of how to migrate code using `Backend` in the user guide. Clients using the GHC API can find a backdoor to access the Backend datatype in GHC.Driver.Backend.Internal. Bumps haddock submodule. Fixes #20927
* docs: Fix LlvmVersion in manpage (#21280)Zubin Duggal2022-05-203-5/+7
|
* base: Introduce [sg]etFinalizerExceptionHandlerBen Gamari2022-05-191-0/+4
| | | | | This introduces a global hook which is called when an exception is thrown during finalization.
* driver: Introduce pgmcxxBen Gamari2022-05-171-0/+7
| | | | | | | | | | Here we introduce proper support for compilation of C++ objects. This includes: * logic in `configure` to detect the C++ toolchain and propagating this information into the `settings` file * logic in the driver to use the C++ toolchain when compiling C++ sources
* TcPlugin: access to irreducible givens + fix passed ev_binds_varPavol Vargovcik2022-05-161-4/+9
|
* Update extending_ghc for TcPlugin changessheaf2022-05-121-6/+6
| | | | | The documentation still mentioned Derived constraints and an outdated datatype TcPluginResult.
* Allow `let` just before pure/return in ApplicativeDoZiyang Liu2022-05-061-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following is currently rejected: ```haskell -- F is an Applicative but not a Monad x :: F (Int, Int) x = do a <- pure 0 let b = 1 pure (a, b) ``` This has bitten me multiple times. This MR contains a simple fix: only allow a "let only" segment to be merged with the next (and not the previous) segment. As a result, when the last one or more statements before pure/return are `LetStmt`s, there will be one more segment containing only those `LetStmt`s. Note that if the `let` statement mentions a name bound previously, then the program is still rejected, for example ```haskell x = do a <- pure 0 let b = a + 1 pure (a, b) ``` or the example in #18559. To support this would require a more complex approach, but this is IME much less common than the previous case.
* Start 9.6.1-notessheaf2022-05-053-435/+25
| | | | | Updates the documentation notes to start tracking changes for the 9.6.1 release (instead of 9.4).
* Update supported LLVM versionsBen Gamari2022-05-041-0/+6
| | | | | | Pull forward minimum version to match 9.2. (cherry picked from commit c26faa54c5fbe902ccb74e79d87e3fa705e270d1)
* users guide: add categories to some flagsAdam Sandberg Ericsson2022-04-301-6/+6
|
* Update user guide example rewrite rules formattingMarius Ghita2022-04-301-3/+3
| | | | | | | | | | | | | | Change the rewrite rule examples to include a space between the composition of `f` and `g` in the map rewrite rule examples. Without this change, if the user has locally enabled the extension OverloadedRecordDot the copied example will result in a compile time error that `g` is not a field of `f`. ``` • Could not deduce (GHC.Records.HasField "g" (a -> b) (a1 -> b)) arising from selecting the field ‘g’ ```
* Update docs for change to type-checking pluginssheaf2022-04-272-2/+13
| | | | | | There was no mention of the changes to type-checking plugins in the 9.4.1 notes, and the extending_ghc documentation contained a reference to an outdated type.
* Enable eventlog support in all ways by defaultBen Gamari2022-04-272-2/+11
| | | | | | | | | | | | | | | | | Here we deprecate the eventlogging RTS ways and instead enable eventlog support in the remaining ways. This simplifies packaging and reduces GHC compilation times (as we can eliminate two whole compilations of the RTS) while simplifying the end-user story. The trade-off is a small increase in binary sizes in the case that the user does not want eventlogging support, but we think that this is a fine trade-off. This also revealed a latent RTS bug: some files which included `Cmm.h` also assumed that it defined various macros which were in fact defined by `Config.h`, which `Cmm.h` did not include. Fixing this in turn revealed that `StgMiscClosures.cmm` failed to import various spinlock statistics counters, as evidenced by the failed unregisterised build. Closes #18948.
* Basic response file supportBen Gamari2022-04-272-0/+14
| | | | | | | | Here we introduce support into our command-line parsing infrastructure and driver for handling gnu-style response file arguments, typically used to work around platform command-line length limitations. Fixes #16476.
* Ensure that Any is Boxed in FFI imports/exportssheaf2022-04-271-2/+3
| | | | | | | | | | We should only accept the type `Any` in foreign import/export declarations when it has type `Type` or `UnliftedType`. This patch adds a kind check, and a special error message triggered by occurrences of `Any` in foreign import/export declarations at other kinds. Fixes #21305
* Document behaviour of RULES with KnownNatBodigrim2022-04-251-0/+9
|
* Drop libtool path from settings fileBen Gamari2022-04-251-7/+0
| | | | | GHC no longers uses libtool for linking and therefore this is no longer necessary.
* Include the way string in the file name for dump files.Andreas Klebinger2022-04-221-0/+11
| | | | | | This can be disabled by `-fno-dump-with-ways` if not desired. Finally we will be able to look at both profiled and non-profiled dumps when compiling with dump flags and we compile in both ways.
* Add -dkeep-comments flag to keep comments in the parserAlan Zimmerman2022-04-201-0/+7
| | | | | | | | | This provides a way to set the Opt_KeepRawTokenStream from the command line, allowing exact print annotation users to see exactly what is produced for a given parsed file, when used in conjunction with -ddump-parsed-ast Discussed in #19706, but this commit does not close the issue.
* Document that DuplicateRecordFields doesn't tolerates ambiguous fieldsHécate Moonlight2022-04-123-106/+70
| | | | Fix #19891
* Add flag -fprof-manual which controls if GHC should honour manual cost centres.Andreas Klebinger2022-04-081-0/+11
| | | | | | | This allows disabling of manual control centres in code a user doesn't control like libraries. Fixes #18867
* Fixes to 9.4 release notesKrzysztof Gogolewski2022-04-083-10/+22
| | | | | | - Mention -Wforall-identifier - Improve description of withDict - Fix formatting
* Properly explain where INLINE pragmas can appear.Andreas Klebinger2022-04-071-6/+41
| | | | Fixes #20676
* Add warnings for file header pragmas that appear in the body of a module ↵Zubin Duggal2022-04-061-0/+14
| | | | | | | | | | | | | | | (#20385) Once we are done parsing the header of a module to obtain the options, we look through the rest of the tokens in order to determine if they contain any misplaced file header pragmas that would usually be ignored, potentially resulting in bad error messages. The warnings are reported immediately so that later errors don't shadow over potentially helpful warnings. Metric Increase: T13719
* users-guide: Fix various markup issuesBen Gamari2022-04-011-15/+15
|
* Implement \cases (Proposal 302)Jakob Bruenker2022-04-013-5/+25
| | | | | | | | | | | | This commit implements proposal 302: \cases - Multi-way lambda expressions. This adds a new expression heralded by \cases, which works exactly like \case, but can match multiple apats instead of a single pat. Updates submodule haddock to support the ITlcases token. Closes #20768
* Keep track of promotion ticks in HsOpTywip/no-c-stubswip/matt-merge-batchsheaf2022-04-012-0/+11
| | | | | | | | | | | | | | | | This patch adds a PromotionFlag field to HsOpTy, which is used in pretty-printing and when determining whether to emit warnings with -fwarn-unticked-promoted-constructors. This allows us to correctly report tick-related warnings for things like: type A = Int : '[] type B = [Int, Bool] Updates haddock submodule Fixes #19984
* docs: Update documentation interaction of search path, -hidir and -c mode.Matthew Pickering2022-04-011-5/+9
| | | | | | | | | As noted in #20569 the documentation for search path was wrong because it seemed to indicate that `-i` dirs were important when looking for interface files in `-c` mode, but they are not important if `-hidir` is set. Fixes #20569
* Change GHC.Prim to GHC.Exts in docs and testsKrzysztof Gogolewski2022-04-013-5/+4
| | | | | Users are supposed to import GHC.Exts rather than GHC.Prim. Part of #18749.
* Add tests and docs on plugin args and order.Phil de Joux2022-04-011-1/+30
|
* Clarify that runghc interprets the input programMorrow2022-04-011-2/+2
|
* new datatypes for parsedResultActionJakob Bruenker2022-04-012-27/+29
| | | | | | | | Previously, the warnings and errors were given and returned as a tuple (Messages PsWarnings, Messages PsErrors). Now, it's just PsMessages. This, together with the HsParsedModule the parser plugin gets and returns, has been wrapped up as ParsedResult.
* users-guide: Fix a few small issues in eventlog format descriptionsBen Gamari2022-04-011-1/+2
| | | | | The CONC_MARK_END event description didn't mention its payload. Clarify the meaning of the CREATE_TASK's payload.
* Give parsing plugins access to errorsJakob Brünker2022-03-302-7/+30
| | | | | | | | | | | Previously, when the parser produced non-fatal errors (i.e. it produced errors but the 'PState' is 'POk'), compilation would be aborted before the 'parsedResultAction' of any plugin was invoked. This commit changes that, so that such that 'parsedResultAction' gets collections of warnings and errors as argument, and must return them after potentially modifying them. Closes #20803
* users-guide: group ticky-ticky profiling under one headingAdam Sandberg Ericsson2022-03-281-5/+5
|
* Document typed splices inhibiting unused bind detection (#16524)jberryman2022-03-281-0/+3
|
* users-guide: Correct markdown for profilingTakenobu Tani2022-03-281-5/+6
| | | | | | This patch corrects some markdown. [skip ci]
* Add the OPAQUE pragmaChristiaan Baaij2022-03-252-0/+27
| | | | | | | | | | | | A new pragma, `OPAQUE`, that ensures that every call of a named function annotated with an `OPAQUE` pragma remains a call of that named function, not some name-mangled variant. Implements GHC proposal 0415: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0415-opaque-pragma.rst This commit also updates the haddock submodule to handle the newly introduced lexer tokens corresponding to the OPAQUE pragma.
* Fix behaviour of -Wunused-packages in ghciMatthew Pickering2022-03-231-5/+9
| | | | | | | | | | | | | | | | | Ticket #21110 points out that -Wunused-packages behaves a bit unusually in GHCi. Now we define the semantics for -Wunused-packages in interactive mode as follows: * If you use -Wunused-packages on an initial load then the warning is reported. * If you explicitly set -Wunused-packages on the command line then the warning is displayed (until it is disabled) * If you then subsequently modify the set of available targets by using :load or :cd (:cd unloads everything) then the warning is (silently) turned off. This means that every :r the warning is printed if it's turned on (but you did ask for it). Fixes #21110
* docs: clarify the eventlog format documentation a little bitAdam Sandberg Ericsson2022-03-231-14/+15
|
* Export (~) from Data.Type.Equality (#18862)wip/eqtycon-rnVladislav Zavialov2022-03-152-3/+62
| | | | | | | | | | * Users can define their own (~) type operator * Haddock can display documentation for the built-in (~) * New transitional warnings implemented: -Wtype-equality-out-of-scope -Wtype-equality-requires-operators Updates the haddock submodule.
* Worker/wrapper: Preserve float barriers (#21150)Sebastian Graf2022-03-131-2/+11
| | | | | | | | | | | | | | | | | | | | | | | Issue #21150 shows that worker/wrapper allocated a worker function for a function with multiple calls that said "called at most once" when the first argument was absent. That's bad! This patch makes it so that WW preserves at least one non-one-shot value lambda (see `Note [Preserving float barriers]`) by passing around `void#` in place of absent arguments. Fixes #21150. Since the fix is pretty similar to `Note [Protecting the last value argument]`, I put the logic in `mkWorkerArgs`. There I realised (#21204) that `-ffun-to-thunk` is basically useless with `-ffull-laziness`, so I deprecated the flag, simplified and split into `needsVoidWorkerArg`/`addVoidWorkerArg`. SpecConstr is another client of that API. Fixes #21204. Metric Decrease: T14683
* Rename -fprof-late-ccs to -fprof-lateAndreas Klebinger2022-03-122-3/+3
|
* Always generalise top-level bindingsSimon Peyton Jones2022-03-071-17/+25
| | | | | Fix #21023 by always generalising top-level binding; change the documentation of -XMonoLocalBinds to match.
* Update documentation of LiberalTypeSynonymsKrzysztof Gogolewski2022-03-041-21/+1
| | | | | | | | | We no longer require LiberalTypeSynonyms to use 'forall' or an unboxed tuple in a synonym. I also removed that kind checking before expanding synonyms "could be changed". This was true when type synonyms were thought of macros, but with the extensions such as SAKS or matchability I don't see it changing.
* docs: Add note to RULES documentation about locally bound variables [skip ci]Matthew Pickering2022-03-031-0/+25
| | | | Fixes #20100
* Improve out-of-order inferred type variablessheaf2022-03-022-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't instantiate type variables for :type in `GHC.Tc.Gen.App.tcInstFun`, to avoid inconsistently instantianting `r1` but not `r2` in the type forall {r1} (a :: TYPE r1) {r2} (b :: TYPE r2). ... This fixes #21088. This patch also changes the primop pretty-printer to ensure that we put all the inferred type variables first. For example, the type of reallyUnsafePtrEquality# is now forall {l :: Levity} {k :: Levity} (a :: TYPE (BoxedRep l)) (b :: TYPE (BoxedRep k)). a -> b -> Int# This means we avoid running into issue #21088 entirely with the types of primops. Users can still write a type signature where the inferred type variables don't come first, however. This change to primops had a knock-on consequence, revealing that we were sometimes performing eta reduction on keepAlive#. This patch updates tryEtaReduce to avoid eta reducing functions with no binding, bringing it in line with tryEtaReducePrep, and thus fixing #21090.
* Ticky profiling improvements.Matthew Pickering2022-03-021-0/+148
| | | | | | | | | | | | | | | | | | | | This adds a number of changes to ticky-ticky profiling. When an executable is profiled with IPE profiling it's now possible to associate id-related ticky counters to their source location. This works by emitting the info table address as part of the counter which can be looked up in the IPE table. Add a `-ticky-ap-thunk` flag. This flag prevents the use of some standard thunks which are precompiled into the RTS. This means reduced cache locality and increased code size. But it allows better attribution of execution cost to specific source locations instead of simple attributing it to the standard thunk. ticky-ticky now uses the `arg` field to emit additional information about counters in json format. When ticky-ticky is used in combination with the eventlog eventlog2html can be used to generate a html table from the eventlog similar to the old text output for ticky-ticky.
* Ticky: Gate tag-inference dummy ticky-counters behind a flag.Andreas Klebinger2022-02-252-1/+25
| | | | | | | | | | Tag inference included a way to collect stats about avoided tag-checks. This was dony by emitting "dummy" ticky entries with counts corresponding to predicted/unpredicated tag checks. This behaviour for ticky is now gated behind -fticky-tag-checks. I also documented ticky-LNE in the process.