summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
* Add safe list indexing operator: !?Oleg Grenrus2023-01-094-5/+34
| | | | | | 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.
* Explain the auxiliary functions of permutationsFacundo Domínguez2023-01-031-0/+27
|
* Document infelicities of instance Ord Double and workaroundsBodigrim2022-12-241-23/+30
|
* Store RdrName rather than OccName in HolesMatthew Pickering2022-12-241-0/+4
| | | | | | | | | | | | | | | | | In #20472 it was pointed out that you couldn't defer out of scope but the implementation collapsed a RdrName into an OccName to stuff it into a Hole. This leads to the error message for a deferred qualified name dropping the qualification which affects the quality of the error message. This commit adds a bit more structure to a hole, so a hole can replace a RdrName without losing information about what that RdrName was. This is important when printing error messages. I also added a test which checks the Template Haskell deferral of out of scope qualified names works properly. Fixes #22130
* 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.
* Refactor mkRuntimeErrorSimon Peyton Jones2022-12-222-11/+16
| | | | | | | | | This patch fixes #22634. Because we don't have TYPE/CONSTRAINT polymorphism, we need two error functions rather than one. I took the opportunity to rname runtimeError to impossibleError, to line up with mkImpossibleExpr, and avoid confusion with the genuine runtime-error-constructing functions.
* Don't consider large byte arrays/compact regions pinned.Andreas Klebinger2022-12-221-0/+7
| | | | | Workaround for #22255 which showed how treating large/compact regions as pinned could cause segfaults.
* ghc-boot: Fix bootstrappingBen Gamari2022-12-211-3/+6
|
* base: Bump version to 4.18Ben Gamari2022-12-2115-6/+6
| | | | Requires various submodule bumps.
* Update submodule transformers to 0.6.0.4Bodigrim2022-12-211-0/+0
|
* Update submodule haskeline to HEAD (to allow transformers-0.6)Bodigrim2022-12-211-0/+0
|
* Allow transformers-0.6 in ghc, ghci, ghc-bin and hadrianBodigrim2022-12-211-1/+1
|
* Correct `exitWith` Haddocksamesgen2022-12-181-7/+5
| | | | The `IOError`-specific `catch` in the Prelude is long gone.
* base: add missing autoconf checks for waitpid/umaskCheng Shao2022-12-172-0/+12
| | | | These are not present in wasi-libc. Required for fixing #22589
* Bump submodule directory to 1.3.8.0 and hpc to HEADBodigrim2022-12-162-0/+0
|
* Mark T21336a fragileBryan Richter2022-12-121-1/+4
|
* Document that Bifunctor instances for tuples are lawful only up to lazinessBodigrim2022-12-111-2/+11
|
* Add heqT, a kind-heterogeneous variant of heqOleg Grenrus2022-12-112-2/+11
| | | | CLC proposal https://github.com/haskell/core-libraries-committee/issues/99
* Update containers submoduleMatthew Pickering2022-12-091-0/+0
| | | | | | This contains a fix necessary for the multi-repl to work on GHC's code base where we try to load containers and template-haskell into the same session.
* 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.
* Update submodule mtl to 2.3.1, parsec to 3.1.15.1, haddock and Cabal to HEADBodigrim2022-12-083-0/+0
|
* Add initial support for LoongArch Architecture.lrzlin2022-12-082-0/+4
|
* Restore show (typeRep @[]) == "[]"Krzysztof Gogolewski2022-12-081-0/+2
| | | | | | | | | The Show instance for TypeRep [] has changed in 9.5 to output "List" because the name of the type constructor changed. This seems to be accidental and is inconsistent with TypeReps of saturated lists, which are printed as e.g. "[Int]". For now, I'm restoring the old behavior; in the future, maybe we should show TypeReps without puns (List, Tuple, Type).
* Mark Type.Reflection.Unsafe as UnsafeKrzysztof Gogolewski2022-12-082-1/+2
| | | | | This module can be used to construct ill-formed TypeReps, so it should be Unsafe.
* Fix bounds-checking buglet in Data.Array.ByteMatthew Craven2022-12-081-3/+5
| | | | | ...another manifestation of #20851 which I unfortunately missed in my first pass.
* Handle type data declarations in Template Haskell quotations and splices ↵Ross Paterson2022-12-035-3/+46
| | | | | | | (fixes #22500) This adds a TypeDataD constructor to the Template Haskell Dec type, and ensures that the constructors it contains go in the TyCls namespace.
* Make Functor a quantified superclass of Bifunctor.Baldur Blöndal2022-11-303-4/+25
| | | | | | | | | | | 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-308-67/+67
| | | | | | | | | | | | | 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-304-5/+18
| | | | Fixes #22453
* Add Javascript backendSylvain Henry2022-11-2940-116/+3425
| | | | | | | | | | | | | | | 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>
* Move hs_mulIntMayOflo cbits to ghc-primCheng Shao2022-11-282-0/+4
| | | | | | It's only used by wasm NCG at the moment, but ghc-prim is a more reasonable place for hosting out-of-line primops. Also, we only need a single version of hs_mulIntMayOflo.
* Review suggestions for assorted fixes to avoid Data.List.{head,tail}sheaf2022-11-252-6/+8
|
* Assorted fixes to avoid Data.List.{head,tail}Bodigrim2022-11-258-16/+20
|
* CApiFFI: add ConstPtr for encoding const-qualified pointer return types (#22043)nineonine2022-11-231-0/+6
| | | | | | | | | | | | | Previously, when using `capi` calling convention in foreign declarations, code generator failed to handle const-cualified pointer return types. This resulted in CC toolchain throwing `-Wincompatible-pointer-types-discards-qualifiers` warning. `Foreign.C.Types.ConstPtr` newtype was introduced to handle these cases - special treatment was put in place to generate appropritetly qualified C wrapper that no longer triggers the above mentioned warning. Fixes #22043
* Add unsafePtrEquality# restricted to UnliftedTypesOleg Grenrus2022-11-223-15/+33
|
* Add since pragmas for c_interruptible_open and hostIsThreadedBodigrim2022-11-201-0/+10
|
* Extend documentation for Data.IORefBodigrim2022-11-202-16/+63
|
* base: make Foreign.Marshal.Pool use RTS internal arena for allocationCheng Shao2022-11-162-27/+29
| | | | | | | | | | | | | | | | | | `Foreign.Marshal.Pool` used to call `malloc` once for each allocation request. Each `Pool` maintained a list of allocated pointers, and traverses the list to `free` each one of those pointers. The extra O(n) overhead is apparently bad for a `Pool` that serves a lot of small allocation requests. This patch uses the RTS internal arena to implement `Pool`, with these benefits: - Gets rid of the extra O(n) overhead. - The RTS arena is simply a bump allocator backed by the block allocator, each allocation request is likely faster than a libc `malloc` call. Closes #14762 #18338.
* Fix capitalization in haddock for TestEqualityBodigrim2022-11-151-3/+3
|
* Type vs Constraint: finally nailedSimon Peyton Jones2022-11-114-11/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This big patch addresses the rats-nest of issues that have plagued us for years, about the relationship between Type and Constraint. See #11715/#21623. The main payload of the patch is: * To introduce CONSTRAINT :: RuntimeRep -> Type * To make TYPE and CONSTRAINT distinct throughout the compiler Two overview Notes in GHC.Builtin.Types.Prim * Note [TYPE and CONSTRAINT] * Note [Type and Constraint are not apart] This is the main complication. The specifics * New primitive types (GHC.Builtin.Types.Prim) - CONSTRAINT - ctArrowTyCon (=>) - tcArrowTyCon (-=>) - ccArrowTyCon (==>) - funTyCon FUN -- Not new See Note [Function type constructors and FunTy] and Note [TYPE and CONSTRAINT] * GHC.Builtin.Types: - New type Constraint = CONSTRAINT LiftedRep - I also stopped nonEmptyTyCon being built-in; it only needs to be wired-in * Exploit the fact that Type and Constraint are distinct throughout GHC - Get rid of tcView in favour of coreView. - Many tcXX functions become XX functions. e.g. tcGetCastedTyVar --> getCastedTyVar * Kill off Note [ForAllTy and typechecker equality], in (old) GHC.Tc.Solver.Canonical. It said that typechecker-equality should ignore the specified/inferred distinction when comparein two ForAllTys. But that wsa only weakly supported and (worse) implies that we need a separate typechecker equality, different from core equality. No no no. * GHC.Core.TyCon: kill off FunTyCon in data TyCon. There was no need for it, and anyway now we have four of them! * GHC.Core.TyCo.Rep: add two FunTyFlags to FunCo See Note [FunCo] in that module. * GHC.Core.Type. Lots and lots of changes driven by adding CONSTRAINT. The key new function is sORTKind_maybe; most other changes are built on top of that. See also `funTyConAppTy_maybe` and `tyConAppFun_maybe`. * Fix a longstanding bug in GHC.Core.Type.typeKind, and Core Lint, in kinding ForAllTys. See new tules (FORALL1) and (FORALL2) in GHC.Core.Type. (The bug was that before (forall (cv::t1 ~# t2). blah), where blah::TYPE IntRep, would get kind (TYPE IntRep), but it should be (TYPE LiftedRep). See Note [Kinding rules for types] in GHC.Core.Type. * GHC.Core.TyCo.Compare is a new module in which we do eqType and cmpType. Of course, no tcEqType any more. * GHC.Core.TyCo.FVs. I moved some free-var-like function into this module: tyConsOfType, visVarsOfType, and occCheckExpand. Refactoring only. * GHC.Builtin.Types. Compiletely re-engineer boxingDataCon_maybe to have one for each /RuntimeRep/, rather than one for each /Type/. This dramatically widens the range of types we can auto-box. See Note [Boxing constructors] in GHC.Builtin.Types The boxing types themselves are declared in library ghc-prim:GHC.Types. GHC.Core.Make. Re-engineer the treatment of "big" tuples (mkBigCoreVarTup etc) GHC.Core.Make, so that it auto-boxes unboxed values and (crucially) types of kind Constraint. That allows the desugaring for arrows to work; it gathers up free variables (including dictionaries) into tuples. See Note [Big tuples] in GHC.Core.Make. There is still work to do here: #22336. But things are better than before. * GHC.Core.Make. We need two absent-error Ids, aBSENT_ERROR_ID for types of kind Type, and aBSENT_CONSTRAINT_ERROR_ID for vaues of kind Constraint. Ditto noInlineId vs noInlieConstraintId in GHC.Types.Id.Make; see Note [inlineId magic]. * GHC.Core.TyCo.Rep. Completely refactor the NthCo coercion. It is now called SelCo, and its fields are much more descriptive than the single Int we used to have. A great improvement. See Note [SelCo] in GHC.Core.TyCo.Rep. * GHC.Core.RoughMap.roughMatchTyConName. Collapse TYPE and CONSTRAINT to a single TyCon, so that the rough-map does not distinguish them. * GHC.Core.DataCon - Mainly just improve documentation * Some significant renamings: GHC.Core.Multiplicity: Many --> ManyTy (easier to grep for) One --> OneTy GHC.Core.TyCo.Rep TyCoBinder --> GHC.Core.Var.PiTyBinder GHC.Core.Var TyCoVarBinder --> ForAllTyBinder AnonArgFlag --> FunTyFlag ArgFlag --> ForAllTyFlag GHC.Core.TyCon TyConTyCoBinder --> TyConPiTyBinder Many functions are renamed in consequence e.g. isinvisibleArgFlag becomes isInvisibleForAllTyFlag, etc * I refactored FunTyFlag (was AnonArgFlag) into a simple, flat data type data FunTyFlag = FTF_T_T -- (->) Type -> Type | FTF_T_C -- (-=>) Type -> Constraint | FTF_C_T -- (=>) Constraint -> Type | FTF_C_C -- (==>) Constraint -> Constraint * GHC.Tc.Errors.Ppr. Some significant refactoring in the TypeEqMisMatch case of pprMismatchMsg. * I made the tyConUnique field of TyCon strict, because I saw code with lots of silly eval's. That revealed that GHC.Settings.Constants.mAX_SUM_SIZE can only be 63, because we pack the sum tag into a 6-bit field. (Lurking bug squashed.) Fixes * #21530 Updates haddock submodule slightly. Performance changes ~~~~~~~~~~~~~~~~~~~ I was worried that compile times would get worse, but after some careful profiling we are down to a geometric mean 0.1% increase in allocation (in perf/compiler). That seems fine. There is a big runtime improvement in T10359 Metric Decrease: LargeRecord MultiLayerModulesTH_OneShot T13386 T13719 Metric Increase: T8095
* 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-116-4/+104
| | | | | This base patch avoids using unsupported posix functionality on wasm32.
* base: more autoconf checks for wasm32Cheng Shao2022-11-111-0/+9
| | | | | | This patch adds more autoconf checks to base, since those functions and headers may exist on other POSIX systems but don't exist on wasm32.
* base: fall back to using monotonic clock to emulate cputime on wasm32Cheng Shao2022-11-114-0/+30
| | | | | On wasm32, we have to fall back to using monotonic clock to emulate cputime, since there's no native support for cputime as a clock id.
* Add support for the wasm32-wasi target tupleCheng Shao2022-11-111-0/+4
| | | | | | This patch adds the wasm32-wasi tuple support to various places in the tree: autoconf, hadrian, ghc-boot and also the compiler. The codegen logic will come in subsequent commits.
* 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
|