| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
Previously the haddocks for Control.Monad and Data.Functor gave
the impression that `fmap` was the only Functor method.
Fixes #16681.
|
|
|
|
|
|
| |
As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail
Coauthored-by: Ben Gamari <ben@well-typed.com>
|
|
|
|
|
| |
This moves all URL references to Trac tickets to their corresponding
GitLab counterparts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Alexandre Balde (rockbmb) points out that the fusion technology
for foldr2, zip, zipWith, etc is undocumented. This patch adds
comments to explain.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Reviewers: hvr, bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4871
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
as the latter is the official, correct spelling, and the former just a
misspelling accepted by GHC.
Also document in the user’s guide that the alternative spelling is
accepted
This commit was brough to you by HIW 2016.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is another documentation addition similar to D1989, this time
comparing the type of the Kleisli composition operator (<=<) to that
of plain function composition (.).
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In my testing, the worker/wrapper transformation applied here
significantly decreases the number of allocations performed when using
replicateM_. Additionally, this version of the function behaves
correctly for negative numbers (namely, it will behave the same as
replicateM_ 0, which is what previous versions of base have done).
Reviewers: bgamari, simonpj, hvr, austin
Reviewed By: bgamari, simonpj, austin
Subscribers: nomeata, simonpj, mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2086
GHC Trac Issues: #11795
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements phase 1 of the MonadFail proposal (MFP, #10751).
- MonadFail warnings are all issued as desired, tunable with two new flags
- GHC was *not* made warning-free with `-fwarn-missing-monadfail-warnings`
(but it's disabled by default right now)
Credits/thanks to
- Franz Thoma, whose help was crucial to implementing this
- My employer TNG Technology Consulting GmbH for partially funding us
for this work
Reviewers: goldfire, austin, #core_libraries_committee, hvr, bgamari, fmthoma
Reviewed By: hvr, bgamari, fmthoma
Subscribers: thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1248
GHC Trac Issues: #10751
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generalize `filterM`, `mapAndUnzipM`, `zipWithM`, `zipWithM_`,
`replicateM`, and `replicateM_`.
Reviewers: ekmett, #core_libraries_committee, austin, hvr, bgamari
Reviewed By: ekmett, #core_libraries_committee, bgamari
Subscribers: ekmett, glguy, thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1324
GHC Trac Issues: #10168
|
|
|
|
|
|
|
|
|
| |
This generalizes forever to depend on Applicative, rather than Monad.
This was proposed a month ago
(https://mail.haskell.org/pipermail/libraries/2015-May/025711.html).
Differential Revision: https://phabricator.haskell.org/D1045
|
|
|
|
|
|
| |
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
|
|
|
|
|
|
|
|
|
| |
With this change `Control.Monad.foldM` becomes an alias for
`Data.Foldable.foldlM`.
Reviewed By: austin, ekmett
Differential Revision: https://phabricator.haskell.org/D251
|
|
|
|
| |
analogously to mapM. Fixes #9546.
|
|
|
|
| |
This was missed in D253 / a07ce1654ac5b8033f2daf9270c6e182415b69ca
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generalise `when`/`unless`from `Monad` to `Applicative` and `guard` from
`MonadPlus` to `Alternative` respectively.
This was made possible by the AMP and is somewhat related to #9586
(but generalising in the context of the AMP instead of the FTP)
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D253
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was done in d94de87252d0fe2ae97341d186b03a2fbe136b04 to avoid orphans
but since a94dc4c3067c6a0925e2e39f35ef0930771535f1 moved `Alternative`
into GHC.Base, this isn't needed anymore.
This is important, as otherwise this would require a non-neglectable amount
of `Control.Monad hiding ((<|>), empty)` imports in user code.
The Haddock submodule is updated as well
Test Plan: partial local ./validate --fast, let Harbormaster doublecheck it
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D248
|
|
|
|
| |
...several modules in `base` recently touched by me
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This flips the switch and replaces the entities in
`Data.List`/`Control.Monad` conflicting with
`Data.{Foldable,Traversable}` with re-exports of the more general
versions.
As of this commit, the code below (which is also added as a test-case)
compiles w/o error.
module XPrelude (module X) where
import Control.Monad as X
import Data.Foldable as X
import Data.List as X
import Data.Monoid as X
import Data.Traversable as X
import Prelude as X
This addresses #9568
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D235
|
|
|
|
|
|
|
|
|
|
| |
This simplifies the import graph and more importantly removes import
cycles that arise due to `Control.Monad` & `Data.List` importing
`Data.Traversable` (preparation for #9586)
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D234
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This finally takes the gloves off, and performs the first actual
generalization in order to implement #9586. This re-exports the
respective definitions for the 4 combinators defined in Data.Foldable.
This way, importing Data.Foldable and Control.Monad unqualified won't bring
conflicting definitions of those 4 entities into scope anymore.
This change seems to have some minor effect on rule-firing, which
causes some wibble in the test-case T4007
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D226
|
|
|
|
|
|
|
|
|
| |
This is the last preparation needed before generalizing entities in
Control.Monad conflicting with those from Data.Foldable (re #9586)
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D225
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both modules still export `void`, but `void`'s implementation now lives in
Data.Functor where it actually belongs in (as it doesn't need a Monad context)
The desired side-effect of this is to invert the import-dep
between Control.Monad and Data.Functor.
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D224
|
|
|
|
|
|
|
|
|
|
|
| |
This is necessary in order to invert the import-dependency between
Data.Foldable and Control.Monad (for addressing #9586)
This also updates the `binary` submodule to qualify a GHC.Base import
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D223
|
|
|
|
|
|
|
|
|
| |
This allows several modules to avoid importing Control.Monad and thus break
import cycles that manifest themselves when implementing #9586
Reviewed By: austin, ekmett
Differential Revision: https://phabricator.haskell.org/D222
|
|
|
|
|
|
|
|
|
| |
This allows GHC.Stack to avoid importing Control.Monad, and
is preparatory work for implementing #9586
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D221
|
|
|
|
|
|
|
| |
Since we now had to major bump due to AMP being landed, `base-4.7.1.0` is not
gonna happen, as we're going straight for a `base-4.8.0.0` release.
[skip ci] since this is a doc-only change
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This includes pretty much all the changes needed to make `Applicative`
a superclass of `Monad` finally. There's mostly reshuffling in the
interests of avoid orphans and boot files, but luckily we can resolve
all of them, pretty much. The only catch was that
Alternative/MonadPlus also had to go into Prelude to avoid this.
As a result, we must update the hsc2hs and haddock submodules.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Test Plan: Build things, they might not explode horribly.
Reviewers: hvr, simonmar
Subscribers: simonmar
Differential Revision: https://phabricator.haskell.org/D13
|
|
|
|
|
| |
Specialise liftM, foldM, etc, and make them specialisable
for new monads at their call sites by using INLINEABLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A strict (<$>) has been proposed numerous times. The first time
around[1] by Johan Tibell, and the last time around[2] by David
Luposchainsky. David's thread was able to avoid The Bikeshed Monster,
and his (<$!>) proposal received unanimous +1s all around.
This addresses #9099.
[1]: http://www.haskell.org/pipermail/libraries/2013-November/021728.html
[2]: http://www.haskell.org/pipermail/libraries/2014-April/022864.html
Authored-by: Alexander Berntsen <alexander@plaimi.net>
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
| |
Now that HUGS and NHC specific code has been removed, this commit "folds"
the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This
renders `base` officially GHC only.
This commit also removes redundant `{-# LANGUAGE CPP #-}`.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These comments are rather less useful now that haddock can give docs
with the same informatino in the module synopsis.
Having to maintain them when making changes to the library is a pain,
and when people forget about doing so there is nothing that checks that
the comments are right, so mistakes tend to linger.
Of the comments that my script detected, 78 of 684 were already
incorrect in one way or another, e.g. missing context:
Text.Show.showsPrec
Comment type: Int -> a -> ShowS
Actual type: Show a => Int -> a -> ShowS
wrong context:
Numeric.readInt
Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
Actual type: Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
not following a class change (e.g. Num losing its Eq superclass):
Text.Read.Lex.readOctP
Comment type: Num a => ReadP a
Actual type: (Eq a, Num a) => ReadP a
not following the Exceptions change:
GHC.Conc.childHandler
Comment type: Exception -> IO ()
Actual type: SomeException -> IO ()
or just always been wrong:
GHC.Stable.deRefStablePtr
Comment type: StablePtr a -> a
Actual type: StablePtr a -> IO a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous implementation was:
forever a = a >> forever a
which can create a space leak in some cases, even with optimizations.
The current implementation:
forever a = let a' = a >> a' in a'
prevents repeated thunk allocations by creating a single thunk for the
final result, even without optimizations.
|
| |
|