summaryrefslogtreecommitdiff
path: root/libraries/base
Commit message (Collapse)AuthorAgeFilesLines
...
* base: Move CString, CStringLen to GHC.ForeignBen Gamari2022-10-112-11/+6
|
* ByteArray# is unlifted, not unboxedBodigrim2022-10-111-4/+4
|
* Expand comment for Data.List.permutationsjwaldmann2022-10-111-0/+3
|
* Extend documentation for Data.List, mostly wrt infinite listsBodigrim2022-10-113-53/+216
|
* Add a newline before since pragma in Data.Array.ByteBodigrim2022-10-101-0/+1
|
* Export symbolSing, SSymbol, and friends (CLC#85)wip/clc-85Ryan Scott2022-10-066-103/+447
| | | | | | | | | | | | | | | 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.
* Minor fixes following Unicode 15.0.0 updatePierre Le Marre2022-10-052-8/+4
| | | | | - Fix changelog for Unicode 15.0.0 - Fix the checksums of the downloaded Unicode files, in base's tool: "ucd2haskell".
* Use sameByteArray# in sameByteArrayOleg Grenrus2022-10-041-2/+1
|
* INLINE/INLINEABLE pragmas in Foreign.Marshal.ArraySimon Peyton Jones2022-09-281-1/+31
| | | | | | | | | | | Foreign.Marshal.Array contains many small functions, all of which are overloaded, and which are critical for performance. Yet none of them had pragmas, so it was a fluke whether or not they got inlined. This patch makes them all either INLINE (small ones) or INLINEABLE and hence specialisable (larger ones). See Note [Specialising array operations] in that module.
* Rename Solo[constructor] to MkSoloTorsten Schmits2022-09-217-35/+35
| | | | | | | | | | | 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-212-0/+8
| | | | Implements #21537
* Relax instances for Functor combinators; put superclass on Class1 and Class2 ↵John Ericson2022-09-205-67/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to make non-breaking This change is approved by the Core Libraries commitee in https://github.com/haskell/core-libraries-committee/issues/10 The first change makes the `Eq`, `Ord`, `Show`, and `Read` instances for `Sum`, `Product`, and `Compose` match those for `:+:`, `:*:`, and `:.:`. These have the proper flexible contexts that are exactly what the instance needs: For example, instead of ```haskell instance (Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where (==) = eq1 ``` we do ```haskell deriving instance Eq (f (g a)) => Eq (Compose f g a) ``` But, that change alone is rather breaking, because until now `Eq (f a)` and `Eq1 f` (and respectively the other classes and their `*1` equivalents too) are *incomparable* constraints. This has always been an annoyance of working with the `*1` classes, and now it would rear it's head one last time as an pesky migration. Instead, we give the `*1` classes superclasses, like so: ```haskell (forall a. Eq a => Eq (f a)) => Eq1 f ``` along with some laws that canonicity is preserved, like: ```haskell liftEq (==) = (==) ``` and likewise for `*2` classes: ```haskell (forall a. Eq a => Eq1 (f a)) => Eq2 f ``` and laws: ```haskell liftEq2 (==) = liftEq1 ``` The `*1` classes also have default methods using the `*2` classes where possible. What this means, as explained in the docs, is that `*1` classes really are generations of the regular classes, indicating that the methods can be split into a canonical lifting combined with a canonical inner, with the super class "witnessing" the laws[1] in a fashion. Circling back to the pragmatics of migrating, note that the superclass means evidence for the old `Sum`, `Product`, and `Compose` instances is (more than) sufficient, so breakage is less likely --- as long no instances are "missing", existing polymorphic code will continue to work. Breakage can occur when a datatype implements the `*1` class but not the corresponding regular class, but this is almost certainly an oversight. For example, containers made that mistake for `Tree` and `Ord`, which I fixed in https://github.com/haskell/containers/pull/761, but fixing the issue by adding `Ord1` was extremely *un*controversial. `Generically1` was also missing `Eq`, `Ord`, `Read,` and `Show` instances. It is unlikely this would have been caught without implementing this change. ----- [1]: In fact, someday, when the laws are part of the language and not only documentation, we might be able to drop the superclass field of the dictionary by using the laws to recover the superclass in an instance-agnostic manner, e.g. with a *non*-overloaded function with type: ```haskell DictEq1 f -> DictEq a -> DictEq (f a) ``` But I don't wish to get into optomizations now, just demonstrate the close relationship between the law and the superclass. Bump haddock submodule because of test output changing.
* Add `Eq` and `Ord` instances for `Generically1`John Ericson2022-09-202-0/+10
| | | | | These are needed so the subsequent commit overhauling the `*1` classes type-checks.
* Update to Unicode 15.0Pierre Le Marre2022-09-1611-79/+80
|
* Fix typosKrzysztof Gogolewski2022-09-142-2/+2
|
* Diagnostic codes: acccept test changessheaf2022-09-131-1/+1
| | | | | | | | The testsuite output now contains diagnostic codes, so many tests need to be updated at once. We decided it was best to keep the diagnostic codes in the testsuite output, so that contributors don't inadvertently make changes to the diagnostic codes.
* Add native delimited continuations to the RTSAlexis King2022-09-112-1/+23
| | | | | | | | | | | | | | | | | | | | | 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.
* Add changelog entry for liftA2 export from PreludeGeorgi Lyubenov2022-09-081-0/+4
|
* Export liftA2 from PreludeGeorgi Lyubenov2022-09-084-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes: In order to be warning free and compatible, we hide Applicative(..) from Prelude in a few places and instead import it directly from Control.Applicative. Please see the migration guide at https://github.com/haskell/core-libraries-committee/blob/main/guides/export-lifta2-prelude.md for more details. This means that Applicative is now exported in its entirety from Prelude. Motivation: This change is motivated by a few things: * liftA2 is an often used function, even more so than (<*>) for some people. * When implementing Applicative, the compiler will prompt you for either an implementation of (<*>) or of liftA2, but trying to use the latter ends with an error, without further imports. This could be confusing for newbies. * For teaching, it is often times easier to introduce liftA2 first, as it is a natural generalisation of fmap. * This change seems to have been unanimously and enthusiastically accepted by the CLC members, possibly indicating a lot of love for it. * This change causes very limited breakage, see the linked issue below for an investigation on this. See https://github.com/haskell/core-libraries-committee/issues/50 for the surrounding discussion and more details.
* typoEric Lindblad2022-09-071-1/+1
|
* Change Ord defaults per CLC proposalTommy Bidne2022-09-011-0/+3
| | | | Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/24#issuecomment-1233331267
* Add since annotations and changelog entriesHarry Garrood2022-08-252-0/+5
|
* Add inits1 and tails1 to Data.List.NonEmptyHarry Garrood2022-08-253-2/+96
| | | | See https://github.com/haskell/core-libraries-committee/issues/67
* Print constraints in quotes (#21167)Swann Moreau2022-08-191-1/+1
| | | | | | | This patch improves the uniformity of error message formatting by printing constraints in quotes, as we do for types. Fix #21167
* base: Add changelog entries from ghc-9.2Ben Gamari2022-08-161-6/+47
| | | | Closes #21922.
* Document that threadDelay / timeout are susceptible to overflows on 32-bit ↵Bodigrim2022-08-108-1/+48
| | | | 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-064-1/+20
|
* rts: Move thread labels into TSOBen Gamari2022-08-064-14/+23
| | | | | | | 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-066-1/+49
| | | | | | | 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
* testsuite: Skip a few tests as in the nonmoving collectorBen Gamari2022-07-251-1/+5
| | | | | | | | | Residency monitoring under the non-moving collector is quite conservative (e.g. the reported value is larger than reality) since otherwise we would need to block on concurrent collection. Skip a few tests that are sensitive to residency. (cherry picked from commit 6880e4fbf728c04e8ce83e725bfc028fcb18cd70)
* Default implementation for mempty/(<>)Gabriella Gonzalez2022-07-252-1/+23
| | | | | | | | | | | | 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-222-0/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add mapAccumM, forAccumM to Data.TraversableBoris Lykah2022-07-193-5/+80
| | | | | Approved by Core Libraries Committee in https://github.com/haskell/core-libraries-committee/issues/65#issuecomment-1186275433
* typosEric Lindblad2022-07-1827-35/+35
|
* changelog typoEric Lindblad2022-07-181-1/+1
|
* Fix incorrect proof of applyWhen’s propertiesAnselm Schüler2022-07-171-1/+1
|
* 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
|
* Add applyWhen to Data.Function per CLC propAnselm Schüler2022-07-042-0/+30
| | | | Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/71#issuecomment-1165830233
* Expand `Ord` instance for `Down`konsumlamm2022-07-031-0/+6
| | | | Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/23#issuecomment-1172932610
* Data.Foldable1: Remove references to Foldable-specific noteSimon Jakobi2022-07-021-4/+0
| | | | | ...as discussed in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8495#note_439455.
* Cleanup BuiltInSyntax vs UserSyntaxMatthew Pickering2022-06-284-9/+0
| | | | | | | | | | | | There was some confusion about whether FUN/TYPE/One/Many should be BuiltInSyntax or UserSyntax. The answer is certainly UserSyntax as BuiltInSyntax is for things which are directly constructed by the parser rather than going through normal renaming channels. I fixed all the obviously wrong places I could find and added a test for the original bug which was caused by this (#21752) Fixes #21752 #20695 #18302
* Add Foldable1 and Bifoldable1 type classesBodigrim2022-06-274-1/+566
| | | | | | | | | | | | Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/9 Instances roughly follow https://hackage.haskell.org/package/semigroupoids-5.3.7/docs/Data-Semigroup-Foldable-Class.html#t:Foldable1 but the API of `Foldable1` was expanded in comparison to `semigroupoids`. Compatibility shim is available from https://github.com/phadej/foldable1 (to be released). Closes #13573.
* Remove the traces of i386-*-openbsd, long live amd64Greg Steuck2022-06-271-2/+2
| | | | | | | | | | | OpenBSD will not ship any ghc packages on i386 starting with 7.2 release. This means there will not be a bootstrap compiler easily available. The last available binaries are ghc-8.10.6 which is already not supported as bootstrap for HEAD. See here for more information: https://marc.info/?l=openbsd-ports&m=165060700222580&w=2
* Bump ghc-prim and base versionsBen Gamari2022-06-272-3/+3
| | | | | | | | | To 0.9.0 and 4.17.0 respectively. Bumps array, deepseq, directory, filepath, haskeline, hpc, parsec, stm, terminfo, text, unix, haddock, and hsc2hs submodules. (cherry picked from commit ba47b95122b7b336ce1cc00896a47b584ad24095)