summaryrefslogtreecommitdiff
path: root/libraries
Commit message (Collapse)AuthorAgeFilesLines
* Use TypeLits in the meta-data encoding of GHC.Genericswip/GenericsMetaData2Jose Pedro Magalhaes2014-11-231-150/+174
| | | | | The following wiki page contains more information about this: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving#Amoreconservativefirstapproachtothisproblem
* Call `popCountBigNat` directly (#9818)Herbert Valerio Riedel2014-11-221-1/+1
| | | | | This calls the `popCountBigNat` primitive directly instead of going through `Integer`'s `popCount`.
* Implement {gcd,lcm}/Natural optimisation (#9818)Herbert Valerio Riedel2014-11-221-0/+27
| | | | | | This provides the equivalent of the existing `{gcd,lcm}/Integer` optimisations for the `Natural` type, when using the `integer-gmp2` backend.
* Fix `fromInteger` constructing invalid `Natural`Herbert Valerio Riedel2014-11-221-1/+1
| | | | | | This fixes a case where `isValidNatural . fromInteger` would be `False`. Re #9818
* Add `isValidNatural` predicate (#9818)Herbert Valerio Riedel2014-11-221-0/+21
| | | | | | | | | This predicate function encodes the internal `Natural` invariants, and is useful for testsuites or code that directly constructs `Natural` values. C.f. `integer-gmp2`'s `isValidBigNat#` and `isValidInteger#` predicates for testing internal invariants.
* Add gcd/Word RULE-based optimisationHerbert Valerio Riedel2014-11-221-0/+9
| | | | | | This makes use of the `gcdWord` primitive provided by be7fb7e58c70cd9b0a933fb26cd5f2607d6dc4b2 which should make the `Word`-variant of `gcd` as performant as the `Int`-variant.
* Remove reference to `MIN_VERSION_integer_gmp2`Herbert Valerio Riedel2014-11-221-1/+1
| | | | | This is slipped in by accident as part of c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a (re #9281)
* integer-gmp2: export `Word`-counterpart of gcdIntHerbert Valerio Riedel2014-11-222-1/+9
| | | | | | It's trivial for `integer-gmp2` (#9281) to provide it, and it'll be useful for a future 'Natural'-related commit, as well as providing a `Word` optimised `gcd`-RULE.
* Implement `Natural` number type (re #9818)Herbert Valerio Riedel2014-11-227-0/+579
| | | | | | | | | | | | | | | | | This implements a `Natural` type for representing unsigned arbitrary precision integers. When available, `integer-gmp>=1.0.0`'s `BigNat` type is used as building-block to construct `Natural` as an algebraic data-type. Otherwise, `Natural` falls back being a `newtype`-wrapper around `Integer` (as is done in Edward Kmett's `nats` package). The `GHC.Natural` module exposes an internal GHC-specific API, while `Numeric.Natural` provides the official & portable API. Reviewed By: austin, ekmett Differential Revision: https://phabricator.haskell.org/D473
* Deprecate Data.Version.versionTags (#2496)Thomas Miedema2014-11-222-1/+3
| | | | | | | | | | | | The library submission was accepted: http://www.haskell.org/pipermail/libraries/2014-September/023777.html The T5892ab testcases were changed to use `Data.Tree` instead of `Data.Version` Reviewed By: ekmett Differential Revision: https://phabricator.haskell.org/D395
* Add function for size-checked conversion of Integral typesSean Leather2014-11-212-1/+107
| | | | | | | | | | | | | | | | The new function `Data.Bits.toIntegralSized` provides a similar functionality to `fromIntegral` but adds validation that the argument fits in the result type's size. The implementation of `toIntegralSized` has been derived from `intCastMaybe` (which is part of Herbert Valerio Riedel's `int-cast` package, see http://hackage.haskell.org/package/int-cast) Addresses #9816 Reviewed By: ekmett, austin Differential Revision: https://phabricator.haskell.org/D512
* Add displayException method to Exception (#9822)Michael Snoyman2014-11-212-0/+11
| | | | | | | | Defaults to using `show` to prevent any breakage of existing code. Also provide a custom implementation for `SomeException` which uses the underlying exception's `displayException`. Differential Revision: https://phabricator.haskell.org/D517
* Be consistent with placement of Safe Haskell mode at top of fileDavid Terei2014-11-2140-48/+52
|
* Improve Safe Haskell bounds for changes to base over timeDavid Terei2014-11-2115-17/+24
|
* Update Foreign.* for Safe Haskell now that they're safe by defaultDavid Terei2014-11-2110-19/+27
|
* Update Control.Monad.ST.* for Safe Haskell as now they're safe by defaultDavid Terei2014-11-217-8/+10
|
* Add 'fillBytes' to Foreign.Marshal.Utils.Alex Petrov2014-11-212-2/+19
| | | | | | | | fillBytes uses 'memset' to fill a memory area with a given byte value. Reviewed By: austin, hvr Differential Revision: https://phabricator.haskell.org/D465
* Add Data.Void to base (re #9814)Herbert Valerio Riedel2014-11-213-0/+78
| | | | | | | | | | | | | | | | | This adds the module `Data.Void` (formerly provided by Edward Kmett's `void` package) to `base`. The original Haskell98 compatible implementation has been modified to use modern GHC features (among others this makes use of `EmptyCase` as motivated by #2431), and `vacuousM` was dropped since it's redundant now with the AMP in place. Instances for classes not part of `base` had to be dropped as well. TODO: Documentation could be improved Reviewed By: ekmett, austin Differential Revision: https://phabricator.haskell.org/D506
* Export scanl' from Data.OldList and Data.ListDavid Feuer2014-11-203-0/+5
| | | | | | | | | | | | | | Summary: Fixes #9368 Reviewers: nomeata, hvr, ekmett, austin Reviewed By: ekmett, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D498 GHC Trac Issues: #9368
* Hide `Data.OldList` moduleHerbert Valerio Riedel2014-11-203-6/+2
| | | | | | | | | | | | | | | | | | | | | Summary: The `Data.OldList` module was originally created in 3daf0023d2dcf7caf85d61f2dc177f8e9421b2fd to provide a way to access the original list-specialised functions from `Data.List`. It was also made an exposed module in order to facilitate adapting the `haskell2010`/`haskell98` packages. However, since the `haskell2010`/`haskell98` packages were dropped, we no longer need to expose `Data.OldList`. Depends on D511 Reviewers: ekmett, austin Reviewed By: ekmett, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D513
* Delete old-{time,locale} and haskell{98,2010}Austin Seipp2014-11-204-0/+0
| | | | | | | | | | | | | | | | | | Summary: Depends on D510. This is the final blow and removes them from the tree completely. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: I looked really hard but didn't see them. Reviewers: hvr, ekmett Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D511 GHC Trac Issues: #9590
* Fix #9220 by adding role annotations.Richard Eisenberg2014-11-203-2/+9
| | | | | This includes a submodule update for `array`. There is also an added test in libraries/array/tests/T9220.
* Make Data.Functor.Identity trustworthy againHerbert Valerio Riedel2014-11-201-0/+1
| | | | | | | | | | | | | | Alas `{-# LANGUAGE Safe #-}` can't be used since `Data.Coerce` isn't "safe". However, we use `coerce` just as an optimisation (see also 4ba884bdd3a9521ea92fcda8f601a7d0f3537bc1 which broke the safe-inferred status of `Data.Functor.Identity`), so this module at least deserves `{-# LANGUAGE Trustworthy #-}`. NOTE: `Data.Functor.Identity` was added to `base` in the context of #9664 Reviewed By: luite Differential Revision: https://phabricator.haskell.org/D507
* Make calling conventions in template haskell Syntax.hs consistent with those ↵Luite Stegeman2014-11-193-5/+10
| | | | | | | | | | | | | | | | | | in ghc ForeignCall.hs this impliments #9703 from ghc trac Test Plan: still needs tests Reviewers: cmsaperstein, ekmett, goldfire, austin Reviewed By: goldfire, austin Subscribers: goldfire, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D353 GHC Trac Issues: #9703
* add missing instances for Loc and a few missing Eq instancesLuite Stegeman2014-11-191-2/+3
| | | | | | | | | | | | Summary: This adds a few missing instances that can be automatically derived Reviewers: hvr, goldfire, austin Reviewed By: goldfire, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D495
* template-haskell: Missing instances for Rational and ().Mathieu Boespflug2014-11-191-2/+9
| | | | | | | | | | | | Test Plan: ./validate Reviewers: austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D492
* Refactor: use System.FilePath.splitSearchPathThomas Miedema2014-11-191-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: To address #2521 ("Trailing colon on GHC_PACKAGE_PATH doesn't work with ghc-pkg"), we were using a custom version of splitSearchPath (e4f46f5de). This solution however caused issue #9698 ("GHC_PACKAGE_PATH should be more lenient for empty paths"). This patch reverts back to System.FilePath.splitSearchPath (fixes #9698) and adresses (#2521) by testing for a trailing search path separators explicitly (instead of implicitly using empty search path elements). Empty paths are now allowed (ignored on Windows, interpreted as current directory on Posix systems), and trailing path separator still tack on the user and system package databases. Also update submodule filepath, which has a version of splitSearchPath which handles quotes in the same way as our custom version did. Test Plan: $ GHC_PACKAGE_PATH=/::/home: ./ghc-pkg list ... db stack: ["/",".","/home","<userdb>","<systemdb>"] ... Reviewers: austin Reviewed By: austin Subscribers: thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D414 GHC Trac Issues: #2521, #9698
* Optimise `Identity` instances with `coerce`Herbert Valerio Riedel2014-11-191-13/+34
| | | | | | | | | | | | This also overrides all optional `Foldable` methods (which would otherwise be default-implemented in terms of `foldMap`) with supposedly optimally minimal implementations. While at it, this also removes the redundant `{-# LANGUAGE CPP #-}`. Reviewed By: austin, dfeuer Differential Revision: https://phabricator.haskell.org/D467
* Reimplement im/export primitives for integer-gmp2Herbert Valerio Riedel2014-11-193-0/+414
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The import/export operations were available in `integer-gmp-0.5.1` already, but need to be reimplemented from scratch for the `integer-gmp-1.0.0` rewrite. This also adds a few more operations than were previously available for use w/ the `BigNat` type (which will be useful for implementing serialisation for the upcoming `Natural` type) Specifically, the following operations are (re)added (albeit with slightly different type-signatures): - `sizeInBaseBigNat` - `sizeInBaseInteger` - `sizeInBaseWord#` - `exportBigNatToAddr` - `exportIntegerToAddr` - `exportWordToAddr` - `exportBigNatToMutableByteArray` - `exportIntegerToMutableByteArray` - `exportWordToMutableByteArray` - `importBigNatFromAddr` - `importIntegerFromAddr` - `importBigNatFromByteArray` - `importIntegerFromByteArray` NOTE: The `integerGmpInternals` test-case is updated but not yet re-enabled as it contains tests for other primitives which aren't yet reimplemented. This addresses #9281 Reviewed By: austin, duncan Differential Revision: https://phabricator.haskell.org/D480
* Revert "base: Fix (**) instance for Data.Complex (#8539)"Austin Seipp2014-11-181-16/+0
| | | | | | This broke validate due to name shadowing warnings. This reverts commit 1f6b1ab4b6d7203481bfaf374b014972f7756fb2.
* mapMaybe: Typo in the comment (#9644)Wieland Hoffmann2014-11-181-1/+1
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* base: Fix (**) instance for Data.Complex (#8539)Austin Seipp2014-11-181-0/+16
| | | | | | | Reviewed-by: Edward Kmett <ekmett@gmail.com> Authored-by: Yalas, Scott Turner Signed-off-by: Austin Seipp <austin@well-typed.com>
* Change a comment referring falsely to seqDavid Feuer2014-11-171-1/+4
| | | | | | | | | | | | | | Summary: Instead, describe what it actually does. Reviewers: austin, ekmett, simonpj, hvr Reviewed By: austin, ekmett Subscribers: simonpj, thomie, carter Projects: #ghc Differential Revision: https://phabricator.haskell.org/D448
* Make listArray fuseDavid Feuer2014-11-171-13/+11
| | | | | | | | | | | | | | Summary: Make listArray fuse with a list producer. Note: if code size increases too much, we can fix that with some `RULES`. Reviewers: nomeata, hvr, austin, ekmett, simonmar, bgamari Reviewed By: bgamari Subscribers: bgamari, thomie, carter Differential Revision: https://phabricator.haskell.org/D474 GHC Trac Issues: #9801
* Remove outdated TODO in TimeManagerYuras Shumovich2014-11-171-26/+0
| | | | | | | | | | | | | | | | Summary: It describes a work around Trac #3838, but it is already fixed and the workaround removed, Trac #7653 Test Plan: not needed Reviewers: hvr, Mikolaj, austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D478
* document addDependentFile uses contents, not mtimeGreg Weber2014-11-171-2/+9
| | | | | | | | | | | | Reviewers: austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D481 GHC Trac Issues: #4900
* Fix compilation of `integer-gmp2` with `-O0`Herbert Valerio Riedel2014-11-151-2/+2
| | | | | | | | | | | | At optimization level `-O0` `wordToInteger` wasn't inlined, and this caused a `__integer` literal to turn up in final Core, which would trigger the GHC panic ghc-stage1: panic! (the 'impossible' happened) (GHC version 7.9.20141114 for x86_64-unknown-linux): Can't use Integer in integer-* By forcing inlining via `inline` this is avoided. This should hopefully address #9800.
* Update to (unreleased) `deepseq-1.4.0.0`Herbert Valerio Riedel2014-11-157-0/+0
| | | | | | | | | | | | | | | | | | | This pulls in the new `Generic`-based `-XDefaultSignature`-based default implementation for `rnf`[1], and will be interesting to use in combination with the soon to be merged `-XDeriveAnyClass` extension. This requires updating several other submodules as well in order to relax the upper bound on `deepseq` and/or in a few cases to avoid relying on the default method implementation of `rnf`: - `Cabal` - `bytestring` - `containers` - `parallel` - `process` - `time` [1]: http://permalink.gmane.org/gmane.comp.lang.haskell.libraries/23031
* Generalize exposed-modules field in installed package databaseEdward Z. Yang2014-11-152-29/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of recording exposed-modules and reexported-modules as seperate fields in the installed package database, this commit merges them into a single field (exposed-modules). The motivation for this change is in preparation for the inclusion of *signatures* into the installed package database, which may also be reexported. Merging the representation means that we can treat reexports uniformly, no matter if they're a normal module or a signature. This commit adds a stub for signatures, but that code isn't wired up to anything yet. Contains Cabal submodule update to accommodate these changes. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, duncan, austin Subscribers: thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D421
* Implement amap/coerce for Array (re #9796)David Feuer2014-11-131-3/+37
| | | | | | | | | | | | | | | | Implement an `amap`/`coerce` rule in `GHC.Arr` to match the `map`/`coerce` rule in GHC.Base. In order to do so, delay inlining `amap` until phase 1. To prevent the inlining delay from causing major inefficiencies due to missed list fusion, rewrite `amap` to avoid relying on list fusion. This has the extra benefit of reducing the size of the compiled amap code by skipping the impossible case of an array with a negative size. Reviewed By: nomeata Differential Revision: https://phabricator.haskell.org/D471
* Fix `integer-gmp2` compilation with GMP 4.x (#9281)Herbert Valerio Riedel2014-11-131-0/+9
| | | | | GMP 4.x didn't provide the `mp_bitcnt_t` typedef yet, so we locally define one if GMP 4.x is detected.
* Improve `Foldable` instance for `Array`David Feuer2014-11-135-6/+214
| | | | | | | | | | | | | | | | | | | | Previously, `Array`s were simply converted to lists, and the list methods used. That works acceptably well for `foldr` and `foldr1`, but not so sensibly for most other things. Left folds ended up "twisted" the way they are for lists, leading to surprising performance characteristics. Moreover, this implements `length` and `null` so they check the array size directly. Finally, a test is added to the testsuite ensuring the overridden `Foldable` methods agree with their expected default semantics. Addresses #9763 Reviewed By: hvr, austin Differential Revision: https://phabricator.haskell.org/D459
* base: define `sequence = mapM id`David Feuer2014-11-131-3/+19
| | | | | | | | | | | | | | | | This avoids duplication in `GHC.Base`; originally, we had mapM f = sequence . map f This led to excessive allocation in `cryptarithm2`. Defining sequence = mapM id does not appear to cause any `nofib` problems. Reviewed By: hvr Differential Revision: https://phabricator.haskell.org/D470
* Make unwords and words fuse somewhatDavid Feuer2014-11-131-4/+43
| | | | | | | | | | | | | Make `words` a good producer and `unwords` a good consumer for list fusion. Thus `unwords . words` will avoid producing an intermediate list of words, although it will produce each individual word. Make `unwords` slightly lazier, so that `unwords (s : undefined) = s ++ undefined` instead of `= undefined`. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D375
* base: Fix map/coerce commentDavid Feuer2014-11-131-3/+2
| | | | | | | | | Make the comment on the map/coerce rule refer to the right section in the paper; give the full name of the papers, and name its authors. [skip ci] Differential Revision: https://phabricator.haskell.org/D472
* Add `--fwarn-trustworthy-safe` to `-Wall`David Terei2014-11-125-0/+0
| | | | | Update submodule haskell2010, haskell98, hoop, hpc and stm to fix new warnings.
* Fix #9064 by adding support for generic default signatures to TH.Richard Eisenberg2014-11-124-1/+11
|
* Fix #8100, by adding StandaloneDerivD to TH's Dec type.Richard Eisenberg2014-11-124-1/+12
|
* Derive Generic for TH types (#9527)Richard Eisenberg2014-11-121-41/+42
|
* Remove unboxed Int# fields from NameFlavour (#9527)Richard Eisenberg2014-11-122-98/+19
|