summaryrefslogtreecommitdiff
path: root/libraries/base/Control
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in documentation of Base.hs.Matthias Braun2019-12-051-1/+1
|
* base: Ensure that failIO isn't SOURCE importedBen Gamari2019-11-011-2/+1
| | | | | | | | | failIO has useful information in its demand signature (specifically that it bottoms) which is hidden if it is SOURCE imported, as noted in #16588. Rejigger things such that we don't SOURCE import it. Metric Increase: T13701
* Use an IORef for QSemNDavid Feuer2019-10-231-39/+51
| | | | | | | Replace the outer `MVar` in `QSemN` with an `IORef`. This should probably be lighter, and it removes the need for `uninterruptibleMask`. Previously Differential Revision https://phabricator.haskell.org/D4896
* base: add Functor, Applicative, Monad, Alternative, MonadPlus, Generic and ↵Fumiaki Kinoshita2019-07-281-0/+43
| | | | Generic1 instances to Kleisli
* Added do-notation examples for Functor, Applicative and Monad combinators.Baldur Blöndal2019-07-201-0/+32
|
* Data.Ord: give a field name getDown to DownFumiaki Kinoshita2019-06-181-1/+0
|
* Implement the -XUnliftedNewtypes extension.Andrew Martin2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | GHC Proposal: 0013-unlifted-newtypes.rst Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/98 Issues: #15219, #1311, #13595, #15883 Implementation Details: Note [Implementation of UnliftedNewtypes] Note [Unifying data family kinds] Note [Compulsory newtype unfolding] This patch introduces the -XUnliftedNewtypes extension. When this extension is enabled, GHC drops the restriction that the field in a newtype must be of kind (TYPE 'LiftedRep). This allows types like Int# and ByteArray# to be used in a newtype. Additionally, coerce is made levity-polymorphic so that it can be used with newtypes over unlifted types. The bulk of the changes are in TcTyClsDecls.hs. With -XUnliftedNewtypes, getInitialKind is more liberal, introducing a unification variable to return the kind (TYPE r0) rather than just returning (TYPE 'LiftedRep). When kind-checking a data constructor with kcConDecl, we attempt to unify the kind of a newtype with the kind of its field's type. When typechecking a data declaration with tcTyClDecl, we again perform a unification. See the implementation note for more on this. Co-authored-by: Richard Eisenberg <rae@richarde.dev>
* base: Include (<$) in all exports of FunctorSimon Jakobi2019-05-271-1/+1
| | | | | | | Previously the haddocks for Control.Monad and Data.Functor gave the impression that `fmap` was the only Functor method. Fixes #16681.
* base: Remove `Monad(fail)` method and reexport `MonadFail(fail)` insteadHerbert Valerio Riedel2019-03-222-4/+3
| | | | | | As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail Coauthored-by: Ben Gamari <ben@well-typed.com>
* Update Trac ticket URLs to point to GitLabRyan Scott2019-03-155-7/+7
| | | | | This moves all URL references to Trac tickets to their corresponding GitLab counterparts.
* base: Allow fusion for zip7 and relatedAlexandre2019-02-241-0/+2
| | | | | | | | | | | | | | | | | | Fixes #14037. Metric Decrease: T9872b T9872d Reviewers: bgamari, simonpj, hvr Reviewed By: simonpj Subscribers: AndreasK, simonpj, osa1, dfeuer, rwbarton, carter GHC Trac Issues: #14037 Differential Revision: https://phabricator.haskell.org/D5249
* Add comments about how zip fusionSimon Peyton Jones2019-02-201-0/+4
| | | | | | Alexandre Balde (rockbmb) points out that the fusion technology for foldr2, zip, zipWith, etc is undocumented. This patch adds comments to explain.
* Remove OPTIONS_HADDOCK hide in favour for not-homeAdam Sandberg Eriksson2019-01-062-2/+2
| | | | GHC Trac Issues: #15447
* make QSem and QSemN newtypeschessai2018-12-172-5/+2
| | | | | | | | | | | | Reviewers: RyanGlScott, ekmett, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15995 Differential Revision: https://phabricator.haskell.org/D5456
* Doc-only fixesAlec Theriault2018-11-224-20/+18
| | | | | | * laws are capitalized definition lists, no emphasis on the labels * adds missing hyperlinks * fixes other misc. Haddock markup issues.
* docs: "state transformer" -> "state monad" / "ST" (whichever is meant)Artem Pelenitsyn2018-08-215-12/+12
| | | | | | | | | | | | | | FIxes #15189. Reviewers: hvr, bgamari, simonmar, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #15189 Differential Revision: https://phabricator.haskell.org/D5019
* Fix ambiguous/out-of-scope Haddock identifiersAlec Theriault2018-08-218-22/+25
| | | | | | | | | | | | | | | | | This drastically cuts down on the number of Haddock warnings when making docs for `base`. Plus this means more actual links end up in the docs! Also fixed other small mostly markup issues in the documentation along the way. This is a docs-only change. Reviewers: hvr, bgamari, thomie Reviewed By: thomie Subscribers: thomie, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5055
* Harden fixSTDavid Feuer2018-07-212-4/+54
| | | | | | | | | | | | | | | | Trac #15349 reveals that lazy blackholing can cause trouble for `fixST` much like it can for `fixIO`. Make `fixST` work just like `fixIO`. Reviewers: simonmar, hvr, bgamari Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15349 Differential Revision: https://phabricator.haskell.org/D4948
* base: Add missing instances for Data.Ord.DownBen Gamari2018-06-192-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: * MonadFix * MonadZip * Data * Foldable * Traversable * Eq1 * Ord1 * Read1 * Show1 * Generic * Generic1 Fixes #15098. Reviewers: RyanGlScott, hvr Reviewed By: RyanGlScott Subscribers: sjakobi, rwbarton, thomie, ekmett, carter GHC Trac Issues: #15098 Differential Revision: https://phabricator.haskell.org/D4870
* Tweak wording in documentationVictor Nawothnig2018-06-191-2/+3
| | | | | | | | Reviewers: hvr, bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4871
* Unmask readMVar in readChanDavid Feuer2018-05-291-10/+1
| | | | | | | | | | | | | | | | When `readMVar` was implemented using `takeMVar` and `putMVar`, we needed to use `modifyMVarMasked` in `readChan` just in case the `readMVar` was interrupted between taking and putting. Now that `readMVar` uses an atomic primop, this is impossible, so we can safely unmask `readMVar`. Reviewers: hvr, bgamari, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4738
* base: Introduce Data.Monoid.Apchessai2018-05-271-1/+5
| | | | | This data type witnesses the lifting of a monoid into an applicative pointwise.
* Fix #15038Ömer Sinan Ağacan2018-05-101-1/+5
| | | | | | | | | | | | | | | | | | | | | We introduce a new Id for unused pointer values in unboxed sums that is not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY definitions CAFFY, fixing #15038. To make sure anything referenced by the new id will be retained we get a stable pointer to in on RTS startup. Test Plan: Passes validate Reviewers: simonmar, simonpj, hvr, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15038 Differential Revision: https://phabricator.haskell.org/D4680
* Add @since annotations for derived instances in baseChaitanya Koparkar2018-03-022-5/+17
| | | | | | | | | | | | | | Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11767 Differential Revision: https://phabricator.haskell.org/D4452
* Various documentation improvementsSergey Vinokurov2018-02-141-2/+2
| | | | | | | | | | | | | | | * Fix missing code example in changelog for 8.4.1 * List 'setEnv' as opposite of 'getEnv' It seems best to direct users to use 'System.Environment.setEnv' rather than 'System.Posix.Env.putEnv'. This is due to 'setEnv' being located in the same module as 'getEnv' and my virtue of working on Windows platform, whereas 'putEnv' does not have that quality because it's part of the 'unix' package. * Reflect in docs the fact that 'readMVar' is not a composition of 'takeMVVar' and 'putMVar' any more
* Kill off irrefutable pattern errorsDavid Feuer2018-01-151-3/+2
| | | | | | | | | | | | | | | | | Distinguishing between "refutable" and "irrefutable" patterns (as described by the Haskell Report) in incomplete pattern errors was more confusing than helpful. Remove references to irrefutable patterns. Reviewers: hvr, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14569 Differential Revision: https://phabricator.haskell.org/D4261
* Fix mistaken mergeBen Gamari2018-01-121-22/+15
| | | | | | | When merging D4259 I had to resort to manual merge due to some conflicts that arc couldn't sort out. Unfortunately in the process I merged the wrong version of the patch. Fix this. Thanks to @ntc2 for the great documentation and noticing my mistake.
* Improve Control.Monad docsNathan Collins2018-01-021-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: * Reformat Control.Monad.mfilter docs The formatting was bad, with everything running together, and a paranthesis was missing. Now the examples and relation between `filter` and `mfilter` are typeset as code blocks instead of inline. * Add example to Control.Monad.join docs The example is using `join . atomically` to run IO actions computed by STM transactions. I couldn't figure out how to link to the STM docs in `Control.Monad.STM`, because that module comes from the `stm` package, not from `base`, even though `stm` is also part of the GHC source tree. So, instead I linked to the STM docs in `GHC.Conc`, which seems inferior to linking to `Control.Monad.STM`, but better than having no links at all. * Add example to Control.Monad.forever docs The example is a simple TCP echo server. To make the uses of `forever` stand out in the example code, I only link to the non-`forever` functions (e.g. `forkFinally`) in the import lists. Reviewers: bgamari, hvr Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4259
* Reformat Control.Monad.mfilter docsNathan Collins2018-01-021-6/+19
| | | | | | The formatting was bad, with everything running together, and a paranthesis was missing. Now the examples and relation between `filter` and `mfilter` are typeset as code blocks instead of inline.
* fdReady: Use C99 bools / CBool in signatureNiklas Hambüchen2017-12-111-7/+7
| | | | | | | | | | Reviewers: bgamari, Phyx, austin, hvr, simonmar Reviewed By: bgamari Subscribers: syd, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4041
* Improve Control.Monad.guard and Control.Monad.MonadPlus docsNathan Collins2017-12-111-2/+41
| | | | | | | | | | | | | This fixes Issue #12372: documentation for Control.Monad.guard not useful after AMP. Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4258
* Fixed misprint 'aqcuired'Kirill Zaborsky2017-12-112-2/+2
|
* base: fdReady(): Fix timeouts > ~49 days overflowing. Fixes #14262.Niklas Hambüchen2017-11-241-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On 64-bit UNIX and Windows, Haskell `Int` has 64 bits but C `int msecs` has 32 bits, resulting in an overflow. This commit fixes it by switching fdReady() to take int64_t, into which a Haskell `Int` will always fit. (Note we could not switch to `long long` because that is 32 bit on 64-bit Windows machines.) Further, to be able to actually wait longer than ~49 days, we put loops around the waiting syscalls (they all accept only 32-bit integers). Note the timer signal would typically interrupt the syscalls before the ~49 days are over, but you can run Haskell programs without the timer signal, an we want it to be correct in all cases. Reviewers: bgamari, austin, hvr, NicolasT, Phyx Reviewed By: bgamari, Phyx Subscribers: syd, Phyx, rwbarton, thomie GHC Trac Issues: #14262 Differential Revision: https://phabricator.haskell.org/D4011
* change example from msum to mfilterJulie Moronuki2017-11-031-2/+2
|
* Fix documentation and comment issuesCyd Parser2017-11-031-1/+1
|
* Add custom exception for fixIODavid Feuer2017-11-021-0/+1
| | | | | | | | | | | | | | | | Traditionally, `fixIO f` throws `BlockedIndefinitelyOnMVar` if `f` is strict. This is not particularly friendly, since the `MVar` in question is just part of the way `fixIO` happens to be implemented. Instead, throw a new `FixIOException` with a better explanation of the problem. Reviewers: austin, hvr, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14356 Differential Revision: https://phabricator.haskell.org/D4113
* base: Remove deprecated Chan combinatorsBen Gamari2017-10-031-23/+2
| | | | | | | | | | | | | | | Removes isEmptyChan and unGetChan, which have been deprecated for a very long time. See #13561. Test Plan: Validate Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13561 Differential Revision: https://phabricator.haskell.org/D4060
* Move NonEmpty definition into GHC.BaseHerbert Valerio Riedel2017-09-042-1/+16
| | | | | | This is a preparatory refactoring for Semigroup=>Monoid as it prevents a messy .hs-boot file which would interact inconveniently with the buildsystem...
* Loads of doc(test)sDavid Luposchainsky2017-08-171-15/+15
|
* Mention the category laws explicitlyDavid Luposchainsky2017-08-171-2/+7
|
* Add forgotten > in Control.ApplicativeOleg Grenrus2017-08-061-1/+1
| | | As reported by tabaqui on `#hackage`
* Fix minor typoIsmail2017-07-111-1/+1
|
* Fix paper link in MVar docs [ci skip]Ömer Sinan Ağacan2017-07-021-1/+1
|
* Typos in comments and manual [ci skip]Gabor Greif2017-06-281-1/+1
|
* Prefer #if defined to #ifdefBen Gamari2017-04-281-6/+6
| | | | Our new CPP linter enforces this.
* Improve `readChan` documentation:Ömer Sinan Ağacan2017-04-101-1/+7
| | | | | | | | | | | | | | | | | - Mention that the read end is an `MVar`, so fairness guarantees are inherited. - Mention that it can throw `BlockedIndefinitelyOnMVar` exception. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #5466 Differential Revision: https://phabricator.haskell.org/D3439
* Add Alternative instance for ZipList (fix #13520).Edvard Hübinette2017-04-041-1/+6
| | | | | | | | | | Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: adamse, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3416
* Make unsafeInterleaveST less unsafeDavid Feuer2017-03-222-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | * Make `unsafeInterleaveST` use `noDuplicate#` like `unsafeInterleaveIO` does to prevent the suspended action from being run in two threads. * In order to accomplish this without `unsafeCoerce#`, generalize the type of `noDuplicate#`. * Add `unsafeDupableInterleaveST` to get the old behavior. * Document unsafe `ST` functions and clean up some related documentation. Fixes #13457 Reviewers: austin, hvr, bgamari, ekmett Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3370
* Elaborate further on ZipList Applicative docsChris Martin2017-03-131-5/+13
| | | | | | | | | | | | | | | | | | | | | I was initially confused when I read "zipWithn" in the haddock for ZipList, went looking for a function named "zipWithn", and found that it didn't exist. This expands the docs to clarify that we're referring to the family of functions [zipWith, zipWith3, zipWith4, ...], capitalizes the letter "n" in "zipWithN" in attempt to make that more readable, and gives an example. I also moved this documentation from ZipList itself to the Applicative instance, so that it will show up in both the Ziplist documentation and in the list of Applicative instances. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3324
* add example documentation for tuple ApplicativeGinBaby2017-03-061-1/+1
| | | | | | | | | | Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3284