summaryrefslogtreecommitdiff
path: root/libraries/base/Control
Commit message (Collapse)AuthorAgeFilesLines
* Move absentError into ghc-prim.Andreas Klebinger2021-02-261-3/+3
| | | | | | | | | | | | 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.
* Apply 1 suggestion(s) to 1 file(s)Marcin Szamotulski2021-02-131-7/+15
|
* Improve bracket documentationMarcin Szamotulski2021-02-131-0/+8
|
* Add instances for GHC.Tuple.SoloBen Gamari2021-01-272-0/+12
| | | | | | | | | | | | | | | 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
* Change replicateM doctest exampleOleg Grenrus2021-01-221-4/+13
|
* Remove references to ApplicativeDo in the base haddocksHécate2021-01-131-26/+11
|
* Correct doctestsOleg Grenrus2021-01-022-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's simpler to assume that base is NoImplicitPrelude, otherwise running doctest on `GHC.*` modules would be tricky. OTOH, most `GHC.List` (where the most name clashes are) examples could be changed to use `import qualified Data.List as L`. (GHC.List examples won't show for Foldable methods...). With these changes majority of doctest examples are GHCi-"faithful", my WIP GHC-independent doctest runner reports nice summary: Examples: 582; Tried: 546; Skipped: 34; Success: 515; Errors: 33; Property Failures 2 Most error cases are *Hangs forever*. I have yet to figure out how to demonstrate that in GHCi. Some of divergences are actually stack overflows, i.e. caught by runtime. Few errorful cases are examples of infinite output, e.g. >>> cycle [42] [42,42,42,42,42,42,42,42,42,42... while correct, they confuse doctest. Another erroneous cases are where expected output has line comment, like >>> fmap show (Just 1) -- (a -> b) -> f a -> f b Just "1" -- (Int -> String) -> Maybe Int -> Maybe String I think I just have to teach doctest to strip comments from expected output. This is a first patch in a series. There is plenty of stuff already.
* Remove redundant "do", "return" and language extensions from baseHécate2020-09-234-4/+4
|
* Remove all the unnecessary LANGUAGE pragmasHécate2020-08-052-11/+10
|
* winio: Multiple refactorings and support changes.Tamar Christina2020-07-151-0/+30
|
* Revert "Specify kind variables for inferred kinds in base."Ben Gamari2020-05-252-4/+4
| | | | | | | | As noted in !3132, this has rather severe knock-on consequences in user-code. We'll need to revisit this before merging something along these lines. This reverts commit 9749fe1223d182b1f8e7e4f7378df661c509f396.
* Fix unboxed-sums GC ptr-slot rubbish value (#17791)Sylvain Henry2020-05-091-5/+1
| | | | | | | This patch allows boot libraries to use unboxed sums without implicitly depending on `base` package because of `absentSumFieldError`. See updated Note [aBSENT_SUM_FIELD_ERROR_ID] in GHC.Core.Make
* Specify kind variables for inferred kinds in base.Baldur Blöndal2020-05-082-4/+4
|
* Add an INLINE pragma to Control.Category.>>>Alexis King2020-04-121-0/+64
| | | | | | | This fixes #18013 by adding INLINE pragmas to both Control.Category.>>> and GHC.Desugar.>>>. The functional change in this patch is tiny (just two lines of pragmas!), but an accompanying Note explains in gory detail what’s going on.
* Add an example to liftIO and explain its purposeHécate2020-04-091-0/+34
|
* Fix haddock formatting in Control.Monad.ST.Lazy.Imp.hsMaxim Koltsov2020-04-031-3/+3
|
* Require GHC 8.8 as the minimum compiler for bootstrappingRyan Scott2020-03-311-6/+5
| | | | | | | | This allows us to remove several bits of CPP that are either always true or no longer reachable. As an added bonus, we no longer need to worry about importing `Control.Monad.Fail.fail` qualified to avoid clashing with `Control.Monad.fail`, since the latter is now the same as the former.
* Base: add markup around ExceptTristan Cacqueray2020-03-251-1/+1
|
* Base: add Control.Applicative optional exampleTristan Cacqueray2020-03-251-0/+17
| | | | | | This change adds an optional example. Tracking: #17929
* 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