summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
* Fix array and cleanup conversion primops (#19026)Sylvain Henry2021-03-0320-325/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
* Add cmpNat, cmpSymbol, and cmpCharDaniel Winograd-Cort2021-03-036-31/+239
| | | | | | | Add Data.Type.Ord Add and update tests Metric Increase: MultiLayerModules
* Pmc: Implement `considerAccessible` (#18610)Sebastian Graf2021-03-011-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | Consider (`T18610`): ```hs f :: Bool -> Int f x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) -> 3 -- Warning: Redundant ``` The third clause will be flagged as redundant. Nevertheless, the programmer might intend to keep the clause in order to avoid bitrot. After this patch, the programmer can write ```hs g :: Bool -> Int g x = case (x, x) of (True, True) -> 1 (False, False) -> 2 (True, False) | GHC.Exts.considerAccessible -> 3 -- No warning ``` And won't be bothered any longer. See also `Note [considerAccessible]` and the updated entries in the user's guide. Fixes #18610 and #19228.
* Mark divModInt and friends as INLINE (#19267)Sebastian Graf2021-02-281-0/+16
| | | | | | | | | | | | | | | | | | So that we don't get a silly worker `$wdivModInt` and risk inlining `divModInt#` into `divModInt` or `$wdivModInt`, making both unlikely to inline at call sites. Fixes #19267. There's a spurious metric decrease (was an *increase*) in T12545. That seems entirely due to shifts in Unique distribution (+5% more `IntMap.$winsert` calls). The inappropriateness of the acceptance window is tracked in #19414. Metric Decrease: T12545 Metric Increase: T12545
* Fix Windows build with autoconf >=2.70 (#19189)Sylvain Henry2021-02-276-6895/+1
|
* Fix typechecking time bug for large rationals (#15646)Andreas Klebinger2021-02-271-0/+19
| | | | | | | | | When desugaring large overloaded literals we now avoid computing the `Rational` value. Instead prefering to store the significant and exponent as given where reasonable and possible. See Note [FractionalLit representation] for details.
* Remove the -xt heap profiling optionMatthew Pickering2021-02-271-3/+0
| | | | | | | It should be left to tooling to perform the filtering to remove these specific closure types from the profile if desired. Fixes #16795
* Move absentError into ghc-prim.Andreas Klebinger2021-02-262-3/+61
| | | | | | | | | | | | When using -fdicts-strict we generate references to absentError while compiling ghc-prim. However we always load ghc-prim before base so this caused linker errors. We simply solve this by moving absentError into ghc-prim. This does mean it's now a panic instead of an exception which can no longer be caught. But given that it should only be thrown if there is a compiler error that seems acceptable, and in fact we already do this for absentSumFieldError which has similar constraints.
* Fix #19363 by using pprName' {Applied,Infix} in the right placesRyan Scott2021-02-261-22/+22
| | | | | | | | | | | | It was revealed in #19363 that the Template Haskell pretty-printer implemented in `Language.Haskell.TH.Ppr` did not pretty-print infix names or symbolic names correctly in certain situations, such as in data constructor declarations or fixity declarations. Easily fixed by using `pprName' Applied` (which always parenthesizes symbolic names in prefix position) or `pprName' Infix` (which always surrounds alphanumeric names with backticks in infix position) in the right spots. Fixes #19363.
* Add test case for CompleteP pretty-printer (#19270)Ole Krüger2021-02-223-0/+9
|
* Fix TemplateHaskell pretty printer for CompleteP (#19270)Ole Krüger2021-02-221-1/+1
| | | | The COMPLETE pragma was not properly terminated with a '#-}'.
* Add the docspec:base rule to HadrianHécate2021-02-221-0/+3
|
* Make openFile exception safeDavid Feuer2021-02-228-118/+429
| | | | | | | | | | | | | | | | | | | * `openFile` could sometimes leak file descriptors if it received an asynchronous exception (#19114, #19115). Fix this on POSIX. * `openFile` and more importantly `openFileBlocking` could not be interrupted effectively during the `open` system call (#17912). Fix this on POSIX. * Implement `readFile'` using `withFile` to ensure the file is closed promptly on exception. * Avoid `bracket` in `withFile`, reducing the duration of masking. Closes #19130. Addresses #17912, #19114, and #19115 on POSIX systems, but not on Windows.
* base: Fix order of infix declarations in Data.FunctorBen Gamari2021-02-181-2/+2
| | | | | | | As pointed in #19284, previously the order was a bit confusing. This didn't affect the meaning but nevertheless it's much clearer now. Closes #19284.
* Rectify the haddock markup surrounding symbols for foldl' and foldMap'Hécate Moonlight2021-02-181-23/+23
| | | | closes #19365
* Add Generic tuple instances up to 15Andrzej Rybczak2021-02-161-0/+48
|
* Replace more autotools obsolete macros (#19189)Sylvain Henry2021-02-163-13/+10
|
* Implement NoFieldSelectors extension (ghc-proposals 160)Adam Gundry2021-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | | Fixes #5972. This adds an extension NoFieldSelectors to disable the generation of selector functions corresponding to record fields. When this extension is enabled, record field selectors are not accessible as functions, but users are still able to use them for record construction, pattern matching and updates. See Note [NoFieldSelectors] in GHC.Rename.Env for details. Defining the same field multiple times requires the DuplicateRecordFields extension to be enabled, even when NoFieldSelectors is in use. Along the way, this fixes the use of non-imported DuplicateRecordFields in GHCi with -fimplicit-import-qualified (fixes #18729). Moreover, it extends DisambiguateRecordFields to ignore non-fields when looking up fields in record updates (fixes #18999), as described by Note [DisambiguateRecordFields for updates]. Co-authored-by: Simon Hafner <hafnersimon@gmail.com> Co-authored-by: Fumiaki Kinoshita <fumiexcel@gmail.com>
* Throw IOError when allocaBytesAligned gets non-power-of-two alignDaniel Gröber2021-02-142-2/+25
|
* Improve ByteArray# documentation regarding alignmentDaniel Gröber2021-02-142-1/+11
|
* ghc-compact: Use keepAlive# in GHC.Compact.SerializedBen Gamari2021-02-141-10/+2
|
* base: Use keepAlive# in Foreign.Marshal.AllocBen Gamari2021-02-141-25/+4
|
* base: Use keepAlive# in withForeignPtrBen Gamari2021-02-141-1/+3
|
* Introduce keepAlive primopBen Gamari2021-02-143-15/+37
|
* Bump bytestring submoduleBen Gamari2021-02-141-0/+0
| | | | Teach it to use unsafeWithForeignPtr where appropriate.
* base: Use unsafeWithForeignPtr in GHC.IO.BufferBen Gamari2021-02-141-5/+6
|
* base: Eliminate allocating withForeignPtrs from GHC.Event.ArrayBen Gamari2021-02-141-15/+17
|
* base: Add unsafeWithForeignPtrBen Gamari2021-02-142-26/+38
|
* Bignum: fix bogus rewrite rule (#19345)Sylvain Henry2021-02-131-5/+16
| | | | | | | | Fix the following rule: "fromIntegral/Int->Natural" fromIntegral = naturalFromWord . fromIntegral Its type wasn't constrained to Int hence #19345.
* Remove deprecated -XGenerics and -XMonoPatBindsKrzysztof Gogolewski2021-02-131-1/+0
| | | | | They have no effect since 2011 (GHC 7.2/7.4), commits cb698570b2b and 49dbe60558.
* Remove Data.Semigroup.OptionSimon Jakobi2021-02-134-88/+2
| | | | | | Bumps the binary and deepseq submodules. Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/15028.
* closeFd: improve documentationMarcin Szamotulski2021-02-131-4/+5
| | | | | | | I think it is worth to say that closeFd is interruptible by asynchronous exceptions. And also fix indentation of closeFd_.
* Make closeFdWith uninterrupitbleMarcin Szamotulski2021-02-131-2/+5
| | | | | | | | | | | | | closeFdWith is accessing shared TMVar - the IO manager callbak table var. It might be concurrently used by different threads: either becuase it contains information about different file descriptors or a single file descriptor is accessed from different threads. For this reason `takeMVar` might block, although for a very short time as all the IO operations are using epoll (or its equivalent). This change makes hClose and Network.Socket.close safe in presence of asynchronous exceptions. This is especailly important in the context of `bracket` which expects uninterruptible close handler.
* Apply 1 suggestion(s) to 1 file(s)Marcin Szamotulski2021-02-131-7/+15
|
* Improve bracket documentationMarcin Szamotulski2021-02-131-0/+8
|
* Fix typosBrian Wignall2021-02-069-10/+10
|
* base: Fix since-annotation for Data.List.singletonSimon Jakobi2021-02-061-1/+1
|
* Make unsafeDupablePerformIO have a lazy demandAndreas Klebinger2021-02-061-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | When a user writes code like: unsafePerformIO $ do let x = f x writeIORef ref x return x We might expect that the write happens before we evaluate `f x`. Sadly this wasn't to case for reasons detailed in #19181. We fix this by avoiding the strict demand by turning: unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a into unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> lazy a This makes the above code lazy in x. And ensures the side effect of the write happens before the evaluation of `f x`. If a user *wants* the code to be strict on the returned value he can simply use `return $! x`. This fixes #19181
* The Char kind (#11342)Daniel Rogozin2021-02-069-10/+102
| | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Rinat Stryungis <rinat.stryungis@serokell.io> Implement GHC Proposal #387 * Parse char literals 'x' at the type level * New built-in type families CmpChar, ConsSymbol, UnconsSymbol * New KnownChar class (cf. KnownSymbol and KnownNat) * New SomeChar type (cf. SomeSymbol and SomeNat) * CharTyLit support in template-haskell Updated submodules: binary, haddock. Metric Decrease: T5205 haddock.base Metric Increase: Naperian T13035
* IntVar: fix allocation sizeSylvain Henry2021-02-051-1/+4
| | | | | | As found by @phadej in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4740/diffs#note_327510 Also fix FastMutInt which allocating the size in bits instead of bytes.
* Remove misleading 'lazy' pattern matches from 'head' and 'tail' in ↵wygulmage2021-02-051-2/+2
| | | | Data.List.NonEmpty
* Add missing instances to ghc-heap typesMatthew Pickering2021-02-022-8/+8
| | | | | | These instances are useful so that a `GenClosure` form `ghc-heap` can be used as a key in a `Map`. Therefore the order itself is not important but just the fact that there is one.
* Fix accidental unsoundness in Data.Typeable.Internal.mkTypeLitFromStringRyan Scott2021-02-014-1/+36
| | | | | | | | | An accidental use of `tcSymbol` instead of `tcNat` in the `TypeLitNat` case of `mkTypeLitFromString` meant that it was possible to unsafely equate `Nat` with `Symbol`. A consequence of this is that you could write `unsafeCoerce`, as observed in #19288. This is fixed easily enough, thankfully. Fixes #19288.
* Add explicit import lists to Data.List importsOleg Grenrus2021-01-293-3/+3
| | | | | | | | | | | | | Related to a future change in Data.List, https://downloads.haskell.org/ghc/8.10.3/docs/html/users_guide/using-warnings.html?highlight=wcompat#ghc-flag--Wcompat-unqualified-imports Companion pull&merge requests: - https://github.com/judah/haskeline/pull/153 - https://github.com/haskell/containers/pull/762 - https://gitlab.haskell.org/ghc/packages/hpc/-/merge_requests/9 After these the actual change in Data.List should be easy to do.
* Implement #18519Koz Ross2021-01-271-0/+38
|
* Fix doctest examples in Data.BitsOleg Grenrus2021-01-271-3/+7
|
* Remove -XMonadFailDesugaring referencesHécate2021-01-271-1/+0
|
* Add instances for GHC.Tuple.SoloBen Gamari2021-01-2711-1/+100
| | | | | | | | | | | | | | | The `Applicative` instance is the most important one (for array/vector/sequence indexing purposes), but it deserves all the usual ones. T12545 does silly 1% wibbles both ways, it seems, maybe depending on architecture. Metric Increase: T12545 Metric Decrease: T12545
* Bignum: add Natural constant folding rules (#15821)Sylvain Henry2021-01-2312-129/+187
| | | | | | | | | | | | | | | | | | | * Implement constant folding rules for Natural (similar to Integer ones) * Add mkCoreUbxSum helper in GHC.Core.Make * Remove naturalTo/FromInt We now only provide `naturalTo/FromWord` as the semantics is clear (truncate/zero-extend). For Int we have to deal with negative numbers (throw an exception? convert to Word beforehand?) so we leave the decision about what to do to the caller. Moreover, now that we have sized types (Int8#, Int16#, ..., Word8#, etc.) there is no reason to bless `Int#` more than `Int8#` or `Word8#` (for example). * Replaced a few `()` with `(# #)`
* FiniteBits for some newtype instances, notes on whyKoz Ross2021-01-231-7/+25
|