summaryrefslogtreecommitdiff
path: root/libraries/base/GHC
Commit message (Collapse)AuthorAgeFilesLines
* Add safe list indexing operator: !?Oleg Grenrus2023-01-091-5/+30
| | | | | | With Joachim's amendments. Implements https://github.com/haskell/core-libraries-committee/issues/110
* Misc cleanupKrzysztof Gogolewski2023-01-051-1/+1
| | | | | | | | | - Remove unused uniques and hs-boot declarations - Fix types of seq and unsafeCoerce# - Remove FastString/String roundtrip in JS - Use TTG to enforce totality - Remove enumeration in Heap/Inspect; the 'otherwise' clause serves the primitive types well.
* base: Fix event manager shutdown race on non-Linux platformsBen Gamari2022-12-221-3/+10
| | | | | | | During shutdown it's possible that we will attempt to use a closed fd to wakeup another capability's event manager. On the Linux eventfd path we were careful to handle this. However on the non-Linux path we failed to do so. Fix this.
* Make `drop` and `dropWhile` fuse (#18964)Sebastian Graf2022-12-081-25/+44
| | | | | | | I copied the fusion framework we have in place for `take`. T18964 asserts that we regress neither when fusion fires nor when it doesn't. Fixes #18964.
* Make (^) INLINE (#22324)Sebastian Graf2022-12-081-24/+57
| | | | | | | | | | | | | So that we get to cancel away the allocation for the lazily used base. We can move `powImpl` (which *is* strict in the base) to the top-level so that we don't duplicate too much code and move the SPECIALISATION pragmas onto `powImpl`. The net effect of this change is that `(^)` plays along much better with inlining thresholds and loopification (#22227), for example in `x2n1`. Fixes #22324.
* Make Functor a quantified superclass of Bifunctor.Baldur Blöndal2022-11-301-0/+12
| | | | | | | | | | | See https://github.com/haskell/core-libraries-committee/issues/91 for discussion. This change relates Bifunctor with Functor by requiring second = fmap. Moreover this change is a step towards unblocking the major version bump of bifunctors and profunctors to major version 6. This paves the way to move the Profunctor class into base. For that Functor first similarly becomes a superclass of Profunctor in the new major version 6.
* Move Void to GHC.Base...Oleg Grenrus2022-11-306-1/+62
| | | | | | | | | | | | | This change would allow `Void` to be used deeper in module graph. For example exported from `Prelude` (though that might be already possible). Also this change includes a change `stimes @Void _ x = x`, https://github.com/haskell/core-libraries-committee/issues/95 While the above is not required, maintaining old stimes behavior would be tricky as `GHC.Base` doesn't know about `Num` or `Integral`, which would require more hs-boot files.
* Fix @since annotations on WithDict and Coerciblesheaf2022-11-301-0/+2
| | | | Fixes #22453
* Add Javascript backendSylvain Henry2022-11-2914-22/+1970
| | | | | | | | | | | | | | | Add JS backend adapted from the GHCJS project by Luite Stegeman. Some features haven't been ported or implemented yet. Tests for these features have been disabled with an associated gitlab ticket. Bump array submodule Work funded by IOG. Co-authored-by: Jeffrey Young <jeffrey.young@iohk.io> Co-authored-by: Luite Stegeman <stegeman@gmail.com> Co-authored-by: Josh Meredith <joshmeredith2008@gmail.com>
* Assorted fixes to avoid Data.List.{head,tail}Bodigrim2022-11-251-1/+1
|
* Add unsafePtrEquality# restricted to UnliftedTypesOleg Grenrus2022-11-222-2/+4
|
* Extend documentation for Data.IORefBodigrim2022-11-201-3/+34
|
* Fix fragile RULE setup in GHC.FloatSimon Peyton Jones2022-11-111-2/+23
| | | | | | | | | | | | | | | In testing my type-vs-constraint patch I found that the handling of Natural literals was very fragile -- and I somehow tripped that fragility in my work. So this patch fixes the fragility. See Note [realToFrac natural-to-float] This made a big (9%) difference in one existing test in perf/should_run/T1-359 Metric Decrease: T10359
* base: avoid using unsupported posix functionality on wasm32Cheng Shao2022-11-113-0/+34
| | | | | This base patch avoids using unsupported posix functionality on wasm32.
* Make indexError work betterSimon Peyton Jones2022-11-101-3/+21
| | | | | | | | | | | | | | | The problem here is described at some length in Note [Boxity for bottoming functions] and Note [Reboxed crud for bottoming calls] in GHC.Core.Opt.DmdAnal. This patch adds a SPECIALISE pragma for indexError, which makes it much less vulnerable to the problem described in these Notes. (This came up in another line of work, where a small change made indexError do reboxing (in nofib/spectral/simple/table_sort) that didn't happen before my change. I've opened #22404 to document the fagility.
* Fire RULES in the SpecialiserSimon Peyton Jones2022-11-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Specialiser has, for some time, fires class-op RULES in the specialiser itself: see Note [Specialisation modulo dictionary selectors] This MR beefs it up a bit, so that it fires /all/ RULES in the specialiser, not just class-op rules. See Note [Fire rules in the specialiser] The result is a bit more specialisation; see test simplCore/should_compile/T21851_2 This pushed me into a bit of refactoring. I made a new data types GHC.Core.Rules.RuleEnv, which combines - the several source of rules (local, home-package, external) - the orphan-module dependencies in a single record for `getRules` to consult. That drove a bunch of follow-on refactoring, including allowing me to remove cr_visible_orphan_mods from the CoreReader data type. I moved some of the RuleBase/RuleEnv stuff into GHC.Core.Rule. The reorganisation in the Simplifier improve compile times a bit (geom mean -0.1%), but T9961 is an outlier Metric Decrease: T9961
* Document what Alternative/MonadPlus instances actually doJade Lovelace2022-11-082-8/+26
|
* Add example for (<$)Jade Lovelace2022-11-081-0/+9
|
* Fix haddocks for GHC.IORefBodigrim2022-11-031-2/+2
|
* Start the deprecation process for GHC.PackHécate Moonlight2022-10-281-0/+5
|
* Fix broken link to `async` packageEvan Relf2022-10-271-1/+1
|
* Build System: Remove out-of-date comment about make build systemMatthew Pickering2022-10-181-4/+0
| | | | | | | | Both make and hadrian interleave compilation of modules of different modules and don't respect the package boundaries. Therefore I just remove this comment which points out this "difference". Fixes #22253
* Add standard Unicode case predicates isUpperCase and isLowerCase.Pierre Le Marre2022-10-142-2/+88
| | | | | | | | These predicates use the standard Unicode case properties and are more intuitive than isUpper and isLower. Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/90#issuecomment-1276649403. Fixes #14589
* winio: do not re-translate input when handle is uncookedTamar Christina2022-10-121-22/+32
|
* Separate IPE source file from spanBen Gamari2022-10-112-11/+20
| | | | | | The source file name can very often be shared across many IPE entries whereas the source coordinates are generally unique. Separate the two to exploit sharing of the former.
* base: Move IPE helpers to GHC.InfoProvBen Gamari2022-10-113-75/+105
|
* base: Move CString, CStringLen to GHC.ForeignBen Gamari2022-10-111-1/+5
|
* Extend documentation for Data.List, mostly wrt infinite listsBodigrim2022-10-111-6/+8
|
* Export symbolSing, SSymbol, and friends (CLC#85)wip/clc-85Ryan Scott2022-10-062-103/+406
| | | | | | | | | | | | | | | This implements this Core Libraries Proposal: https://github.com/haskell/core-libraries-committee/issues/85 In particular, it: 1. Exposes the `symbolSing` method of `KnownSymbol`, 2. Exports the abstract `SSymbol` type used in `symbolSing`, and 3. Defines an API for interacting with `SSymbol`. This also makes corresponding changes for `natSing`/`KnownNat`/`SNat` and `charSing`/`KnownChar`/`SChar`. This fixes #15183 and addresses part (2) of #21568.
* Rename Solo[constructor] to MkSoloTorsten Schmits2022-09-213-28/+28
| | | | | | | | | | | Part of proposal 475 (https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst) Moves all tuples to GHC.Tuple.Prim Updates ghc-prim version (and bumps bounds in dependents) updates haddock submodule updates deepseq submodule updates text submodule
* Add fragmentation statistic to GHC.StatsTeo Camarasu2022-09-211-0/+7
| | | | Implements #21537
* Add `Eq` and `Ord` instances for `Generically1`John Ericson2022-09-201-0/+9
| | | | | These are needed so the subsequent commit overhauling the `*1` classes type-checks.
* Update to Unicode 15.0Pierre Le Marre2022-09-165-7/+7
|
* Fix typosKrzysztof Gogolewski2022-09-141-1/+1
|
* Add native delimited continuations to the RTSAlexis King2022-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | | This patch implements GHC proposal 313, "Delimited continuation primops", by adding native support for delimited continuations to the GHC RTS. All things considered, the patch is relatively small. It almost exclusively consists of changes to the RTS; the compiler itself is essentially unaffected. The primops come with fairly extensive Haddock documentation, and an overview of the implementation strategy is given in the Notes in rts/Continuation.c. This first stab at the implementation prioritizes simplicity over performance. Most notably, every continuation is always stored as a single, contiguous chunk of stack. If one of these chunks is particularly large, it can result in poor performance, as the current implementation does not attempt to cleverly squeeze a subset of the stack frames into the existing stack: it must fit all at once. If this proves to be a performance issue in practice, a cleverer strategy would be a worthwhile target for future improvements.
* typoEric Lindblad2022-09-071-1/+1
|
* Document that threadDelay / timeout are susceptible to overflows on 32-bit ↵Bodigrim2022-08-107-0/+45
| | | | machines
* base: Fix races in IOManager (setNumCapabilities,closeFdWith)Douglas Wilson2022-08-101-19/+75
| | | | | | | | | | | | | Fix for #21651 Fixes three bugs: - writes to eventManager should be atomic. It is accessed concurrently by ioManagerCapabilitiesChanged and closeFdWith. - The race in closeFdWith described in the ticket. - A race in getSystemEventManager where it accesses the 'IOArray' in 'eventManager' before 'ioManagerCapabilitiesChanged' has written to 'eventManager', causing an Array Index exception. The fix here is to 'yield' and retry.
* base: Share finalization thread labelBen Gamari2022-08-062-4/+12
| | | | | | For efficiency's sake we float the thread label assigned to the finalization thread to the top-level, ensuring that we only need to encode the label once.
* Add a primop to query the label of a threadBen Gamari2022-08-061-0/+15
|
* rts: Move thread labels into TSOBen Gamari2022-08-063-14/+19
| | | | | | | This eliminates the thread label HashTable and instead tracks this information in the TSO, allowing us to use proper StgArrBytes arrays for backing the label and greatly simplifying management of object lifetimes when we expose them to the user with the coming `threadLabel#` primop.
* Add primop to list threadsBen Gamari2022-08-062-1/+23
| | | | | | | A user came to #ghc yesterday wondering how best to check whether they were leaking threads. We ended up using the eventlog but it seems to me like it would be generally useful if Haskell programs could query their own threads.
* base: Organize Haddocks in GHC.Conc.SyncBen Gamari2022-08-061-15/+22
|
* Fix since annotations in GHC.Stack.CloneStackMatthew Pickering2022-08-021-5/+5
| | | | Fixes #21894
* Default implementation for mempty/(<>)Gabriella Gonzalez2022-07-251-1/+21
| | | | | | | | | | | | Approved by: https://github.com/haskell/core-libraries-committee/issues/61 This adds a default implementation for `mempty` and `(<>)` along with a matching `MINIMAL` pragma so that `Semigroup` and `Monoid` instances can be defined in terms of `sconcat` / `mconcat`. The description for each class has also been updated to include the equivalent set of laws for the `sconcat`-only / `mconcat`-only instances.
* Add a Note summarising GHC's UTF-8 implementationsBen Gamari2022-07-222-0/+44
| | | | | GHC has a somewhat dizzying array of UTF-8 implementations. This note describes why this is the case.
* base: Introduce GHC.Encoding.UTF8Ben Gamari2022-07-221-0/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here we copy a subset of the UTF-8 implementation living in `ghc-boot` into `base`, with the intent of dropping the former in the future. For this reason, the `ghc-boot` copy is now CPP-guarded on `MIN_VERSION_base(4,18,0)`. Naturally, we can't copy *all* of the functions defined by `ghc-boot` as some depend upon `bytestring`; we rather just copy those which only depend upon `base` and `ghc-prim`. Further consolidation? ---------------------- Currently GHC ships with at least five UTF-8 implementations: * the implementation used by GHC in `ghc-boot:GHC.Utils.Encoding`; this can be used at a number of types including `Addr#`, `ByteArray#`, `ForeignPtr`, `Ptr`, `ShortByteString`, and `ByteString`. Most of this can be removed in GHC 9.6+2, when the copies in `base` will become available to `ghc-boot`. * the copy of the `ghc-boot` definition now exported by `base:GHC.Encoding.UTF8`. This can be used at `Addr#`, `Ptr`, `ByteArray#`, and `ForeignPtr` * the decoder used by `unpackCStringUtf8#` in `ghc-prim:GHC.CString`; this is specialised at `Addr#`. * the codec used by the IO subsystem in `base:GHC.IO.Encoding.UTF8`; this is specialised at `Addr#` but, unlike the above, supports recovery in the presence of partial codepoints (since in IO contexts codepoints may be broken across buffers) * the implementation provided by the `text` library This does seem a tad silly. On the other hand, these implementations *do* materially differ from one another (e.g. in the types they support, the detail in errors they can report, and the ability to recover from partial codepoints). Consequently, it's quite unclear that further consolidate would be worthwhile.
* typosEric Lindblad2022-07-1818-25/+25
|
* rts: allow NULL to be used as an invalid StgStablePtrAdam Sandberg Ericsson2022-07-071-0/+2
|
* winio: make consoleReadNonBlocking not wait for any events at all.Tamar Christina2022-07-071-9/+30
|