summaryrefslogtreecommitdiff
path: root/libraries/base
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix rendering of Applicative lawLi-yao Xia2021-11-101-1/+1
|
* Fix Int64/Word64's Enum instance fusionSylvain Henry2021-11-062-0/+28
| | | | | | | | Performance improvement: T15185(normal) run/alloc 51112.0 41032.0 -19.7% GOOD Metric Decrease: T15185
* Make Word64 use Word64# on every architectureSylvain Henry2021-11-066-405/+22
|
* Remove target dependent CPP for Word64/Int64 (#11470)Sylvain Henry2021-11-064-19/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Primops types were dependent on the target word-size at *compiler* compilation time. It's an issue for multi-target as GHC may not have the correct primops types for the target. This patch fixes some primops types: if they take or return fixed 64-bit values they now always use `Int64#/Word64#`, even on 64-bit architectures (where they used `Int#/Word#` before). Users of these primops may now need to convert from Int64#/Word64# to Int#/Word# (a no-op at runtime). This is a stripped down version of !3658 which goes the all way of changing the underlying primitive types of Word64/Int64. This is left for future work. T12545 allocations increase ~4% on some CI platforms and decrease ~3% on AArch64. Metric Increase: T12545 Metric Decrease: T12545
* Remove record field from SoloSimon Peyton Jones2021-11-054-32/+2
| | | | | | | | | | | | | | Ticket #20562 revealed that Solo, which is a wired-in TyCon, had a record field that wasn't being added to the type env. Why not? Because wired-in TyCons don't have record fields. It's not hard to change that, but it's tiresome for this one use-case, and it seems easier simply to make `getSolo` into a standalone function. On the way I refactored the handling of Solo slightly, to put it into wiredInTyCons (where it belongs) rather than only in knownKeyNames
* Add more INLINABLE and INLINE pragmas to `Enum Int*` instancesSebastian Graf2021-10-293-4/+64
| | | | | Otherwise the instances aren't good list producers. See Note [Stable Unfolding for list producers].
* base: Note export of Data.Tuple.Solo in changelogBen Gamari2021-10-271-1/+4
|
* Tweak descriptions of lines and unlinesViktor Dukhovni2021-10-251-19/+17
| | | | | It seems more clear to think of lines as LF-terminated rather than LF-separated.
* undefined: Neater CallStack in error messageJoachim Breitner2021-10-241-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Users of `undefined` don’t want to see ``` files.hs: Prelude.undefined: CallStack (from HasCallStack): error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err undefined, called at file.hs:151:19 in main:Main ``` but want to see ``` files.hs: Prelude.undefined: CallStack (from HasCallStack): undefined, called at file.hs:151:19 in main:Main ``` so let’s make that so. The function for that is `withFrozenCallStack`, but that is not usable here (module dependencies, and also not representation-polymorphic). And even if it were, it could confuse GHC’s strictness analyzer, leading to big regressions in some perf tests (T10421 in particular). So after shuffling modules and definitions around, I eventually noticed that the easiest way is to just not call `error` here. Fixes #19886
* Fix infelicities in docs for lines, unlines, words, unwordsKoz Ross2021-10-191-13/+45
|
* Insert warnings in the documentation of dangerous functionsTom Sydney Kerckhove2021-10-158-2/+76
|
* Bignum: allow inlining of naturalEq/Ne/Gt/Lt/Ge/Le/Compare (#20361)Sylvain Henry2021-10-071-0/+14
| | | | | | | | | | Perform constant folding on bigNatCompare instead. Some functions of the Enum class for Natural now need to be inlined explicitly to be specialized at call sites (because `x > lim` for Natural is inlined and the resulting function is a little too big to inline). If we don't do this, T17499 runtime allocations regresses by 16%.
* Corrected types of thread ids obtained from the RTSMann mit Hut2021-10-061-1/+1
| | | | | | | | | | | | | | While the thread ids had been changed to 64 bit words in e57b7cc6d8b1222e0939d19c265b51d2c3c2b4c0 the return type of the foreign import function used to retrieve these ids - namely 'GHC.Conc.Sync.getThreadId' - was never updated accordingly. In order to fix that this function returns now a 'CUULong'. In addition to that the types used in the thread labeling subsystem were adjusted as well and several format strings were modified throughout the whole RTS to display thread ids in a consistent and correct way. Fixes #16761
* docs: Clarify documentation of `getFileSystemEncoding` (#20344)Zubin Duggal2021-10-051-1/+3
| | | | It may not always be a Unicode encoding
* Explain Endo, Dual, ... in lawsViktor Dukhovni2021-10-051-2/+40
|
* Adopt David Feuer's explantion of foldl' via foldrViktor Dukhovni2021-10-051-22/+31
|
* Minor wording tweaks/fixesViktor Dukhovni2021-10-052-24/+22
|
* Note elem ticket 20421Viktor Dukhovni2021-10-051-0/+4
|
* Note linear `elem` costViktor Dukhovni2021-10-051-10/+55
| | | | | This is a writeup of the state of play for better than linear `elem` via a helper type class.
* Add laws link and tweak Traversable class textViktor Dukhovni2021-10-051-4/+8
|
* Address some Foldable documentation nitsViktor Dukhovni2021-10-051-14/+18
| | | | | | - Add link to laws from the class head - Simplify wording of left/right associativity intro paragraph - Avoid needless mention of "endomorphisms"
* base: Update Unicode database to 14.0Ben Gamari2021-10-035-112/+208
| | | | Closes #20404.
* Add (++)/literal ruleSylvain Henry2021-10-021-0/+5
| | | | | | | | | | When we derive the Show instance of the big record in #16577, I get the following compilation times (with -O): Before: 0.91s After: 0.77s Metric Decrease: T19695
* Add a regression test for #17912Kamil Dworakowski2021-09-293-0/+36
|
* Use Info Table Provenances to decode cloned stack (#18163)Sven Tennie2021-09-234-37/+194
| | | | | | | | | | | | | | | | Emit an Info Table Provenance Entry (IPE) for every stack represeted info table if -finfo-table-map is turned on. To decode a cloned stack, lookupIPE() is used. It provides a mapping between info tables and their source location. Please see these notes for details: - [Stacktraces from Info Table Provenance Entries (IPE based stack unwinding)] - [Mapping Info Tables to Source Positions] Metric Increase: T12545
* Introduce stack snapshotting / cloning (#18741)Sven Tennie2021-09-232-0/+155
| | | | | | | | | | | | | | Add `StackSnapshot#` primitive type that represents a cloned stack (StgStack). The cloning interface consists of two functions, that clone either the treads own stack (cloneMyStack) or another threads stack (cloneThreadStack). The stack snapshot is offline/cold, i.e. it isn't evaluated any further. This is useful for analyses as it prevents concurrent modifications. For technical details, please see Note [Stack Cloning]. Co-authored-by: Ben Gamari <bgamari.foss@gmail.com> Co-authored-by: Matthew Pickering <matthewtpickering@gmail.com>
* base: Generalize newStablePtrPrimMVarSven Tennie2021-09-231-2/+2
| | | | | Make it polymorphic in the type of the MVar's value. This simple generalization makes it usable for `MVar a` instead of only `MVar ()` values.
* Fix minor inconsistency in documentationalirezaghey2021-09-221-2/+2
| | | | fixes #20388
* Clarify that malloc, free etc. are the ones from stdlib.hOleg Grenrus2021-09-221-0/+5
|
* docs: Fix examples for (un)escapeArgsMatthew Pickering2021-09-181-2/+2
| | | | | | | | | The examples were just missing the surrounding brackets. ghci> escapeArgs ["hello \"world\""] "hello\\ \\\"world\\\"\n" Fixes #20340
* Fix formatting of link in base/Type.ReflectionJoaquin "Florius" Azcarate2021-09-181-2/+1
|
* Add more instances for SoloDavid Feuer2021-09-182-0/+35
| | | | | | | | | Oleg Grenrus pointed out that `Solo` was missing `Eq`, `Ord`, `Bounded`, `Enum`, and `Ix` instances, which were all apparently available for the `OneTuple` type (in the `OneTuple` package). Though only the first three really seem useful, there's no reason not to take them all. For `Ix`, `Solo` naturally fills a gap between `()` and `(,)`.
* testsuite: Add test for #18382Ben Gamari2021-09-173-0/+16
|
* Improve error messages involving operators from Data.Type.OrdChristiaan Baaij2021-09-175-56/+160
| | | | Fixes #20009
* testsuite: Mark hDuplicateTo001 as fragile in concurrent waysBen Gamari2021-09-131-2/+1
| | | | As noted in #17568.
* Break recursion in GHC.Float.roundingMode# (#20352)Sebastian Graf2021-09-111-1/+1
| | | | | | | | | | | | | | | | Judging from the Assumption, we should never call `roundingMode#` on a negative number. Yet the strange "dummy" conversion from `IN` to `IP` and the following recursive call where making the function recursive. Replacing the call by a panic makes `roundingMode#` non-recursive, so that we may be able to inline it. Fixes #20352. It seems we trigger #19414 on some jobs, hence Metric Decrease: T12545
* Remove dubious Eq1 and Ord1 Fixed instances. Fixes #20309Oleg Grenrus2021-09-112-10/+0
|
* base: Numeric: remove 'Show' constraint on 'showIntAtBase'Guillaume Bouchard2021-09-081-6/+6
| | | | | | | | | | The constraint was there in order to show the 'Integral' value in case of error. Instead we can show the result of `toInteger`, which will be close (i.e. it will still show the same integer except if the 'Show' instance was funky). This changes a bit runtime semantic (i.e. exception string may be a bit different).
* Fix broken haddock @since fields in baseJoshua Price2021-09-085-3/+23
|
* base Data.Fixed: fix documentation typo: succ (0.000 :: Milli) /= 1.001 Jens Petersen2021-09-081-1/+1
| | | ie `succ (0000) == 0001` -- (not 1001)
* Bignum: refactor conversion rulesSylvain Henry2021-09-071-0/+26
| | | | | | | | * make "passthrough" rules non built-in: they don't need to * enhance note about efficient conversions between numeric types * make integerFromNatural a little more efficient * fix noinline pragma for naturalToWordClamp# (at least with non built-in rules, we get warnings in cases like this)
* Define returnA = idOleg Grenrus2021-09-062-1/+3
|
* fromEnum Natural: Throw error for non-representable valuesPeter Lebbing2021-09-062-4/+5
| | | | | | | | Starting with commit fe770c21, an error was thrown only for the values 2^63 to 2^64-1 inclusive (on a 64-bit machine), but not for higher values. Now, errors are thrown for all non-representable values again. Fixes #20291
* Export Solo from Data.TupleDavid Feuer2021-08-276-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | * The `Solo` type is intended to be the canonical lifted unary tuple. Up until now, it has only been available from `GHC.Tuple` in `ghc-prim`. Export it from `Data.Tuple` in `base`. I proposed this on the libraries list in December, 2020. https://mail.haskell.org/pipermail/libraries/2020-December/031061.html Responses from chessai https://mail.haskell.org/pipermail/libraries/2020-December/031062.html and George Wilson https://mail.haskell.org/pipermail/libraries/2021-January/031077.html were positive. There were no other responses. * Add Haddock documentation for Solo. * Give `Solo` a single field, `getSolo`, a custom `Show` instance that does *not* use record syntax, and a `Read` instance that accepts either record syntax or non-record syntax.
* Make Int64#/Word64# unconditionally availableJohn Ericson2021-08-193-3/+9
| | | | | | | | This prepares us to actually use them when the native size is 64 bits too. I more than saitisfied my curiosity finding they were gated since 47774449c9d66b768a70851fe82c5222c1f60689.
* Fix iconv detection in configure on OpenBSDGreg Steuck2021-08-151-1/+1
| | | | | | | | | This regressed in 544414ba604b13e0992ad87e90b8bdf45c43011c causing configure: error: iconv is required on non-Windows platforms More details: https://gitlab.haskell.org/ghc/ghc/-/commit/544414ba604b13e0992ad87e90b8bdf45c43011c#3bae3b74ae866493bd6b79df16cb638a5f2e0f87_106_106
* Detect TypeError when checking for insolubilitysheaf2021-08-151-27/+17
| | | | | | | | | | | | | | | We detect insoluble Givens by making getInertInsols take into account TypeError constraints, on top of insoluble equalities such as Int ~ Bool (which it already took into account). This allows pattern matches with insoluble contexts to be reported as redundant (tyOracle calls tcCheckGivens which calls getInertInsols). As a bonus, we get to remove a workaround in Data.Typeable.Internal: we can directly use a NotApplication type family, as opposed to needing to cook up an insoluble equality constraint. Fixes #11503 #14141 #16377 #20180
* Add a Typeable constraint to fromStaticPtr, addressing #19729David Simmons-Duffin2021-08-102-1/+9
|
* Move `/includes` to `/rts/include`, sort per package betterJohn Ericson2021-08-093-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to make the packages in this repo "reinstallable", we need to associate source code with a specific packages. Having a top level `/includes` dir that mixes concerns (which packages' includes?) gets in the way of this. To start, I have moved everything to `rts/`, which is mostly correct. There are a few things however that really don't belong in the rts (like the generated constants haskell type, `CodeGen.Platform.h`). Those needed to be manually adjusted. Things of note: - No symlinking for sake of windows, so we hard-link at configure time. - `CodeGen.Platform.h` no longer as `.hs` extension (in addition to being moved to `compiler/`) so as not to confuse anyone, since it is next to Haskell files. - Blanket `-Iincludes` is gone in both build systems, include paths now more strictly respect per-package dependencies. - `deriveConstants` has been taught to not require a `--target-os` flag when generating the platform-agnostic Haskell type. Make takes advantage of this, but Hadrian has yet to.
* Make `PosixSource.h` installed and under `rts/`John Ericson2021-08-091-1/+1
| | | | | | is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained.