summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
* Apply haddock suggestions from the proposal PRwip/ghc-exception-stacktracesSven Tennie2022-02-233-5/+5
|
* Minimize needed changeset and make root exceptions lazy in their fieldsSven Tennie2022-02-1711-36/+41
| | | | | | | | | | | | | | | | | | | | | | | Libraries that work without any changes: - libraries/array - libraries/directory - libraries/process - libraries/stm - libraries/unix libraries/haskeline needs a small change ------------------------- Metric Decrease: T9630 Metric Increase: LargeRecord MultiComponentModules MultiComponentModulesRecomp T15703 T8095 T9872d -------------------------
* Rename SomeExceptionWithLocation to SomeExceptionWithBacktraceSven Tennie2022-02-1147-125/+125
|
* Add backtrace capturing and wrap SomeException with SomeExceptionWithLocationSven Tennie2022-02-1159-55/+952
| | | | | | | | | | | | | | | | | | | | Replace raise# and raiseIO# with throw and throwIO to append backtraces. And add tests. The structure is now close to the proposal. Add pretty printing of backtraces. ------------------------- Metric Decrease: T19695 T9630 Metric Increase: MultiComponentModules MultiComponentModulesRecomp T13035 T9872d -------------------------
* Introduce 2nd field in SomeExceptionWithLocationSven Tennie2022-02-113-7/+8
|
* Replace SomeException with SomeExceptionWithLocation (#18159)Sven Tennie2022-02-1142-126/+123
| | | | | To keep backwards compatibility, for older GHC versions SomeExceptionWithLocation is only a synonym for SomeException.
* Add metadata to integer-gmp.cabalMorrow2022-02-101-0/+8
|
* Bump Cabal submoduleBen Gamari2022-02-101-0/+0
| | | | | | | | | Adapts GHC to the factoring-out of `Cabal-syntax`. Fixes #20991. Metric Decrease: haddock.Cabal
* ghc-boot: Simplify writePackageDb permissions handlingDaniel Gröber2022-02-101-23/+16
| | | | | | | | | | | | | | | Commit ef8a3fbf1 ("ghc-boot: Fix metadata handling of writeFileAtomic") introduced a somewhat over-engineered fix for #14017 by trying to preserve the current permissions if the target file already exists. The problem in the issue is simply that the package db cache file should be world readable but isn't if umask is too restrictive. In fact the previous fix only handles part of this problem. If the file isn't already there in a readable configuration it wont make it so which isn't really ideal either. Rather than all that we now simply always force all the read access bits to allow access while leaving the owner at the system default as it's just not our business to mess with it.
* Implement System.Environment.getExecutablePath for NetBSDPHO2022-02-092-6/+14
| | | | and also use it from GHC.BaseDir.getBaseDir
* Document that reifyRoles includes kind parametersRichard Eisenberg2022-02-081-1/+13
| | | | Close #21056
* Fix some notesMatthew Pickering2022-02-082-3/+3
|
* Purge DynFlags from GHC.StgJohn Ericson2022-02-061-7/+7
| | | | | Also derive some more instances. GHC doesn't need them, but downstream consumers may need to e.g. put stuff in maps.
* Add the Ix class to Foreign C integral typesHécate Moonlight2022-02-045-2/+10
| | | | Related CLC proposal is here: https://github.com/haskell/core-libraries-committee/issues/30
* Fix @since annotation on NatMorrow2022-02-021-1/+1
|
* Fix a few Note inconsistenciesBen Gamari2022-02-0140-80/+69
|
* Use braces in TH LambdaCase and where clausesElton2022-02-011-3/+13
| | | | | | This patch ensures that the pretty printer formats LambdaCase and where clauses using braces (instead of layout) to remain consistent with the formatting of other statements (like `do` and `case`)
* Use braces in TH case pprint (fixes #20893)Elton2022-02-011-1/+1
| | | | | | This patch ensures that the pretty printer formats `case` statements using braces (instead of layout) to remain consistent with the formatting of other statements (like `do`)
* Rip out remaining SPARC supportBen Gamari2022-01-291-4/+0
|
* rts: Rip out SPARC supportBen Gamari2022-01-291-22/+0
|
* Make most shifts branchlessSylvain Henry2022-01-283-97/+106
|
* Levity-polymorphic arrays and mutable variablessheaf2022-01-265-19/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the following types levity-polymorphic in their last argument: - Array# a, SmallArray# a, Weak# b, StablePtr# a, StableName# a - MutableArray# s a, SmallMutableArray# s a, MutVar# s a, TVar# s a, MVar# s a, IOPort# s a The corresponding primops are also made levity-polymorphic, e.g. `newArray#`, `readArray#`, `writeMutVar#`, `writeIOPort#`, etc. Additionally, exception handling functions such as `catch#`, `raise#`, `maskAsyncExceptions#`,... are made levity/representation-polymorphic. Now that Array# and MutableArray# also work with unlifted types, we can simply re-define ArrayArray# and MutableArrayArray# in terms of them. This means that ArrayArray# and MutableArrayArray# are no longer primitive types, but simply unlifted newtypes around Array# and MutableArrayArray#. This completes the implementation of the Pointer Rep proposal https://github.com/ghc-proposals/ghc-proposals/pull/203 Fixes #20911 ------------------------- Metric Increase: T12545 ------------------------- ------------------------- Metric Decrease: T12545 -------------------------
* ghc-heap: Drop mention of BlockedOnIOCompletionBen Gamari2022-01-242-6/+0
| | | | Fixes bootstrap with GHC 9.0 after 5a6efd218734dbb5c1350531680cd3f4177690f1
* base: Add CTYPE pragmas to all foreign typesBen Gamari2022-01-194-64/+61
| | | | | | | Fixes #15531 by ensuring that we know the corresponding C type for all marshalling wrappers. Closes #15531.
* rts/winio: Fix #18382Ben Gamari2022-01-188-31/+22
| | | | | | | | | | | | | | | | | | | Here we refactor WinIO's IO completion scheme, squashing a memory leak and fixing #18382. To fix #18382 we drop the special thread status introduced for IoPort blocking, BlockedOnIoCompletion, as well as drop the non-threaded RTS's special dead-lock detection logic (which is redundant to the GC's deadlock detection logic), as proposed in #20947. Previously WinIO relied on foreign import ccall "wrapper" to create an adjustor thunk which can be attached to the OVERLAPPED structure passed to the operating system. It would then use foreign import ccall "dynamic" to back out the original continuation from the adjustor. This roundtrip is significantly more expensive than the alternative, using a StablePtr. Furthermore, the implementation let the adjustor leak, meaning that every IO request would leak a page of memory. Fixes T18382.
* winio: fix heap corruption and various leaks.Tamar Christina2022-01-154-16/+19
|
* Remove dangling references to Note [Type-checking overloaded labels]Joachim Breitner2022-01-071-3/+3
| | | | that note was removed in 4196969c53c55191e644d9eb258c14c2bc8467da
* Change ulimit -n in openFile008 back to 1024Greg Steuck2022-01-061-1/+1
| | | | | | | | | | | | | | The test only wants 1000 descriptors, so changing the limit to double that *in the context of just this test* makes no sense. This is a manual revert of 8f7194fae23bdc6db72fc5784933f50310ce51f9. The justification given in the description doesn't instill confidence. As of HEAD, the test fails on OpenBSD where ulimit -n is hard-limited to 1024. The test suite attempts to change it to 2048, which fails. The test proceeds with the unchanged default of 512 and naturally the test program fails due to the low ulimit. The fixed test now passes.
* Fix Haddock parse error in GHC.Exts.Heap.FFIClosures.hsGeorge Thomas2022-01-041-2/+2
|
* Cabal: Update submoduleMatthew Pickering2021-12-291-0/+0
| | | | Closes #20874
* Multiple Home UnitsMatthew Pickering2021-12-284-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Multiple home units allows you to load different packages which may depend on each other into one GHC session. This will allow both GHCi and HLS to support multi component projects more naturally. Public Interface ~~~~~~~~~~~~~~~~ In order to specify multiple units, the -unit @⟨filename⟩ flag is given multiple times with a response file containing the arguments for each unit. The response file contains a newline separated list of arguments. ``` ghc -unit @unitLibCore -unit @unitLib ``` where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode. ``` -this-unit-id lib-core-0.1.0.0 -i -isrc LibCore.Utils LibCore.Types ``` The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core. ``` -this-unit-id lib-0.1.0.0 -package-id lib-core-0.1.0.0 -i -isrc Lib.Parse Lib.Render ``` Then when the compiler starts in --make mode it will compile both units lib and lib-core. There is also very basic support for multiple home units in GHCi, at the moment you can start a GHCi session with multiple units but only the :reload is supported. Most commands in GHCi assume a single home unit, and so it is additional work to work out how to modify the interface to support multiple loaded home units. Options used when working with Multiple Home Units There are a few extra flags which have been introduced specifically for working with multiple home units. The flags allow a home unit to pretend it’s more like an installed package, for example, specifying the package name, module visibility and reexported modules. -working-dir ⟨dir⟩ It is common to assume that a package is compiled in the directory where its cabal file resides. Thus, all paths used in the compiler are assumed to be relative to this directory. When there are multiple home units the compiler is often not operating in the standard directory and instead where the cabal.project file is located. In this case the -working-dir option can be passed which specifies the path from the current directory to the directory the unit assumes to be it’s root, normally the directory which contains the cabal file. When the flag is passed, any relative paths used by the compiler are offset by the working directory. Notably this includes -i and -I⟨dir⟩ flags. -this-package-name ⟨name⟩ This flag papers over the awkward interaction of the PackageImports and multiple home units. When using PackageImports you can specify the name of the package in an import to disambiguate between modules which appear in multiple packages with the same name. This flag allows a home unit to be given a package name so that you can also disambiguate between multiple home units which provide modules with the same name. -hidden-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules in a home unit should not be visible outside of the unit it belongs to. The main use of this flag is to be able to recreate the difference between an exposed and hidden module for installed packages. -reexported-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules are not defined in a unit but should be reexported. The effect is that other units will see this module as if it was defined in this unit. The use of this flag is to be able to replicate the reexported modules feature of packages with multiple home units. Offsetting Paths in Template Haskell splices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When using Template Haskell to embed files into your program, traditionally the paths have been interpreted relative to the directory where the .cabal file resides. This causes problems for multiple home units as we are compiling many different libraries at once which have .cabal files in different directories. For this purpose we have introduced a way to query the value of the -working-dir flag to the Template Haskell API. By using this function we can implement a makeRelativeToProject function which offsets a path which is relative to the original project root by the value of -working-dir. ``` import Language.Haskell.TH.Syntax ( makeRelativeToProject ) foo = $(makeRelativeToProject "./relative/path" >>= embedFile) ``` > If you write a relative path in a Template Haskell splice you should use the makeRelativeToProject function so that your library works correctly with multiple home units. A similar function already exists in the file-embed library. The function in template-haskell implements this function in a more robust manner by honouring the -working-dir flag rather than searching the file system. Closure Property for Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For tools or libraries using the API there is one very important closure property which must be adhered to: > Any dependency which is not a home unit must not (transitively) depend on a home unit. For example, if you have three packages p, q and r, then if p depends on q which depends on r then it is illegal to load both p and r as home units but not q, because q is a dependency of the home unit p which depends on another home unit r. If you are using GHC by the command line then this property is checked, but if you are using the API then you need to check this property yourself. If you get it wrong you will probably get some very confusing errors about overlapping instances. Limitations of Multiple Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are a few limitations of the initial implementation which will be smoothed out on user demand. * Package thinning/renaming syntax is not supported * More complicated reexports/renaming are not yet supported. * It’s more common to run into existing linker bugs when loading a large number of packages in a session (for example #20674, #20689) * Backpack is not yet supported when using multiple home units. * Dependency chasing can be quite slow with a large number of modules and packages. * Loading wired-in packages as home units is currently not supported (this only really affects GHC developers attempting to load template-haskell). * Barely any normal GHCi features are supported, it would be good to support enough for ghcid to work correctly. Despite these limitations, the implementation works already for nearly all packages. It has been testing on large dependency closures, including the whole of head.hackage which is a total of 4784 modules from 452 packages. Internal Changes ~~~~~~~~~~~~~~~~ * The biggest change is that the HomePackageTable is replaced with the HomeUnitGraph. The HomeUnitGraph is a map from UnitId to HomeUnitEnv, which contains information specific to each home unit. * The HomeUnitEnv contains: - A unit state, each home unit can have different package db flags - A set of dynflags, each home unit can have different flags - A HomePackageTable * LinkNode: A new node type is added to the ModuleGraph, this is used to place the linking step into the build plan so linking can proceed in parralel with other packages being built. * New invariant: Dependencies of a ModuleGraphNode can be completely determined by looking at the value of the node. In order to achieve this, downsweep now performs a more complete job of downsweeping and then the dependenices are recorded forever in the node rather than being computed again from the ModSummary. * Some transitive module calculations are rewritten to use the ModuleGraph which is more efficient. * There is always an active home unit, which simplifies modifying a lot of the existing API code which is unit agnostic (for example, in the driver). The road may be bumpy for a little while after this change but the basics are well-tested. One small metric increase, which we accept and also submodule update to haddock which removes ExtendedModSummary. Closes #10827 ------------------------- Metric Increase: MultiLayerModules ------------------------- Co-authored-by: Fendor <power.walross@gmail.com>
* Fix typosKrzysztof Gogolewski2021-12-254-6/+6
|
* testsuite: Remove reqlib modifierMatthew Pickering2021-12-2222-441/+0
| | | | | | | | | | | | | | | | | | | | The reqlib modifer was supposed to indicate that a test needed a certain library in order to work. If the library happened to be installed then the test would run as normal. However, CI has never run these tests as the packages have not been installed and we don't want out tests to depend on things which might get externally broken by updating the compiler. The new strategy is to run these tests in head.hackage, where the tests have been cabalised as well as possible. Some tests couldn't be transferred into the normal style testsuite but it's better than never running any of the reqlib tests. https://gitlab.haskell.org/ghc/head.hackage/-/merge_requests/169 A few submodules also had reqlib tests and have been updated to remove it. Closes #16264 #20032 #17764 #16561
* Expand documentation for MulArrowT constructorMatthew Pickering2021-12-171-1/+3
| | | | Fixes #20812
* Fix documentation formatting in Language.Haskell.TH.CodeDoMatthew Pickering2021-12-171-0/+2
| | | | Fixes #20543
* Add a note to base changelogCheng Shao2021-12-151-0/+4
|
* base: fix autoconf detection of C pointer typesCheng Shao2021-12-151-2/+2
| | | | | | | | We used to attempt compiling `foo_t val; *val;` to determine if `foo_t` is a pointer type in C. This doesn't work if `foo_t` points to an incomplete type, and autoconf will detect `foo_t` as a floating point type in that case. Now we use `memset(val, 0, 0)` instead, and it works for incomplete types as well.
* base: use `CUIntPtr` instead of `Ptr ()` as the autoconf detected Haskell ↵Cheng Shao2021-12-151-1/+1
| | | | | | | | | type for C pointers When autoconf detects a C pointer type, we used to specify `Ptr ()` as the Haskell type. This doesn't work in some cases, e.g. in `wasi-libc`, `clockid_t` is a pointer type, but we expected `CClockId` to be an integral type, and `Ptr ()` lacks various integral type instances.
* libiserv: Rename Lib module to IServBen Gamari2021-12-142-2/+2
| | | | As proposed in #20546.
* Fixes typo in documentation of the Semigroup instance of EquivalenceMichaWiedenmann12021-12-141-1/+1
|
* base: fix clockid_t usage when it's a pointer type in CCheng Shao2021-12-141-4/+5
| | | | Closes #20607.
* fix ambiguity in `const` documentationalirezaghey2021-12-141-1/+1
| | | | fixes #20412
* Data.Functor.Classes: fix Ord1 instance for DownVaibhav Sagar2021-12-142-1/+6
|
* Use HasCallStack and error in GHC.List and .NonEmptyOleg Grenrus2021-12-124-33/+37
| | | | | | | | | | | | | | | | | In addition to providing stack traces, the scary HasCallStack will hopefully make people think whether they want to use these functions, i.e. act as a documentation hint that something weird might happen. A single metric increased, which doesn't visibly use any method with `HasCallStack`. ------------------------- Metric Decrease: T9630 Metric Decrease: T19695 T9630 -------------------------
* iserv: Remove network dependent parts of libiservMatthew Pickering2021-12-124-464/+0
| | | | | | | | | | | | | | As noted in #20794 the parts of libiserv and iserv-proxy depend on network, therefore are never built nor tested during CI. Due to this iserv-proxy had bitrotted due to the bound on bytestring being out of date. Given we don't test this code it seems undesirable to distribute it. Therefore, it's removed and an external maintainer can be responsible for testing it (via head.hackage if desired). Fixes #20794
* Perf: remove allocation in writeBlocks and fix comment (#14309)Sylvain Henry2021-12-111-32/+39
|
* Bump text submodule to 2.0-rc2Bodigrim2021-12-111-0/+0
|
* Add PromotedInfixT/PromotedUInfixT to THJakob Brünker2021-12-115-71/+103
| | | | | | | | | | | | Previously, it was not possible to refer to a data constructor using InfixT with a dynamically bound name (i.e. a name with NameFlavour `NameS` or `NameQ`) if a type constructor of the same name exists. This commit adds promoted counterparts to InfixT and UInfixT, analogously to how PromotedT is the promoted counterpart to ConT. Closes #20773
* Remove confusing haddock quotes in 'readInt' documentationMatthew Pickering2021-12-101-1/+1
| | | | | | | | | As pointed out in #20776, placing quotes in this way linked to the 'Integral' type class which is nothing to do with 'readInt', the text should rather just be "integral", to suggest that the argument must be an integer. Closes #20776
* Improve mtimesDefaultDavid Feuer2021-12-091-3/+22
| | | | | | | * Make 'mtimesDefault' use 'stimes' for the underlying monoid rather than the default 'stimes'. * Explain in the documentation why one might use `mtimesDefault`.