1. 07 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      Make Semigroup a superclass of Monoid (re #14191) · 8ae263ce
      Herbert Valerio Riedel authored
      Unfortunately, this requires introducing a couple of .hs-boot files to
      break up import cycles (mostly to provide class & typenames in order to
      be able to write type signatures).
      
      This does not yet re-export `(<>)` from Prelude (while the class-name
      `Semigroup` is reexported); that will happen in a future commit.
      
      Test Plan: local ./validate passed
      
      Reviewers: ekmett, austin, bgamari, erikd, RyanGlScott
      
      Reviewed By: ekmett, RyanGlScott
      
      GHC Trac Issues: #14191
      
      Differential Revision: https://phabricator.haskell.org/D3927
      8ae263ce
  2. 15 Aug, 2017 1 commit
  3. 29 Apr, 2017 1 commit
  4. 25 Apr, 2017 1 commit
  5. 06 Feb, 2017 1 commit
    • David Feuer's avatar
      Add liftA2 to Applicative class · a2f39da0
      David Feuer authored
      * Make `liftA2` a method of `Applicative`.
      
      * Add explicit `liftA2` definitions to instances in `base`.
      
      * Add explicit invocations in `base`.
      
      Reviewers: ekmett, bgamari, RyanGlScott, austin, hvr
      
      Reviewed By: RyanGlScott
      
      Subscribers: ekmett, RyanGlScott, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3031
      a2f39da0
  6. 15 Oct, 2016 1 commit
  7. 14 Oct, 2016 1 commit
    • Ryan Scott's avatar
      Add missing Semigroup instances for Monoidal datatypes in base · 8c6a3d68
      Ryan Scott authored
      Summary:
      There are currently three datatypes that are exposed in `base` that have
      `Monoid` instances, but no `Semigroup` instances:
      
      * `IO`
      * `Event` (from `GHC.Event`)
      * `Lifetime` (from `GHC.Event`)
      
      (There is also `EventLifetime` in `GHC.Event.Internal`, but it is not exported
      directly, so I didn't bother with it.)
      
      Adding the `Semigroup` instances for these types directly in the modules in
      which they're defined resulted in some horrific import cycles, so I opted to
      take the easy approach of defining all of these instances in `Data.Semigroup`.
      (When `Semigroup` becomes a superclass of `Monoid`, these instances will have
      to be moved somehow.)
      
      Fixes #12464.
      
      Test Plan: It compiles
      
      Reviewers: hvr, ekmett, austin, bgamari
      
      Reviewed By: ekmett
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2588
      
      GHC Trac Issues: #12464
      8c6a3d68
  8. 13 Oct, 2016 1 commit
  9. 18 Jun, 2016 1 commit
    • Ryan Scott's avatar
      Add Bifoldable and Bitraversable to base · 270d545d
      Ryan Scott authored
      This adds `Data.Bifoldable` and `Data.Bitraversable` from the
      `bifunctors` package to `base`, completing the migration started in
      D336.  This is fairly straightforward, although there were a suprising
      amount of reinternal organization in `base` that was needed for this to
      happen:
      
      * `Data.Foldable`, `Data.Traversable`, `Data.Bifoldable`, and
        `Data.Bitraversable` share some nonexported datatypes (e.g., `StateL`,
        `StateR`, `Min`, `Max`, etc.) to implement some instances. To avoid
        code duplication, I migrated this internal code to a new hidden
        module, `Data.Functor.Utils` (better naming suggestions welcome).
      
      * `Data.Traversable` and `Data.Bitraversable` also make use of an
        identity newtype, so I modified them to use
        `Data.Functor.Identity.Identity`. This has a ripple effect on several
        other modules, since I had to move instances around in order to avoid
        dependency cycles.
      
      Fixes #10448.
      
      Reviewers: ekmett, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2284
      
      GHC Trac Issues: #9682, #10448
      270d545d
  10. 06 Jun, 2016 1 commit
  11. 04 Jun, 2016 1 commit
    • Ryan Scott's avatar
      Replace hand-written Bounded instances with derived ones · 59651173
      Ryan Scott authored
      Summary:
      The spiritual successor to D2291, since deriving `Bounded` instances
      in `GHC.Enum` wasn't possible prior to changes made in that Diff.
      
      This Diff finds every manually implemented `Bounded` instance in `base` that is
      completely equivalent to the derived instances, and replaces it.
      
      Reviewers: bgamari, goldfire, austin, hvr
      
      Reviewed By: austin, hvr
      
      Subscribers: thomie, rwbarton
      
      Differential Revision: https://phabricator.haskell.org/D2301
      59651173
  12. 24 May, 2016 1 commit
    • Ryan Scott's avatar
      Remove 'deriving Typeable' statements · 95dfdceb
      Ryan Scott authored
      Summary:
      Deriving `Typeable` has been a no-op since GHC 7.10, and now that we
      require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable`
      statements in GHC.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, hvr, bgamari
      
      Reviewed By: austin, hvr, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2260
      95dfdceb
  13. 01 Jan, 2016 1 commit
    • Herbert Valerio Riedel's avatar
      Canonicalise `MonadPlus` instances · dafeb51f
      Herbert Valerio Riedel authored
      This refactoring exploits the fact that since AMP, in most cases,
      `instance MonadPlus` can be automatically derived from the respective
      `Alternative` instance.  This is because `MonadPlus`'s default method
      implementations are fully defined in terms of `Alternative(empty, (<>))`.
      dafeb51f
  14. 23 Dec, 2015 1 commit
    • Eric Seidel's avatar
      Allow CallStacks to be frozen · 380b25ea
      Eric Seidel authored
      This introduces "freezing," an operation which prevents further
      locations from being appended to a CallStack.  Library authors may want
      to prevent CallStacks from exposing implementation details, as a matter
      of hygiene. For example, in
      
      ```
      head [] = error "head: empty list"
      
      ghci> head []
      *** Exception: head: empty list
      CallStack (from implicit params):
        error, called at ...
      ```
      
      including the call-site of `error` in `head` is not strictly necessary
      as the error message already specifies clearly where the error came
      from.
      
      So we add a function `freezeCallStack` that wraps an existing CallStack,
      preventing further call-sites from being pushed onto it. In other words,
      
      ```
      pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack
      ```
      
      Now we can define `head` to not produce a CallStack at all
      
      ```
      head [] =
        let ?callStack = freezeCallStack emptyCallStack
        in error "head: empty list"
      
      ghci> head []
      *** Exception: head: empty list
      CallStack (from implicit params):
        error, called at ...
      ```
      
      ---
      
      1. We add the `freezeCallStack` and `emptyCallStack` and update the
         definition of `CallStack` to support this functionality.
      
      2. We add `errorWithoutStackTrace`, a variant of `error` that does not
         produce a stack trace, using this feature. I think this is a sensible
         wrapper function to provide in case users want it.
      
      3. We replace uses of `error` in base with `errorWithoutStackTrace`. The
         rationale is that base does not export any functions that use CallStacks
         (except for `error` and `undefined`) so there's no way for the stack
         traces (from Implicit CallStacks) to include user-defined functions.
         They'll only contain the call to `error` itself. As base already has a
         good habit of providing useful error messages that name the triggering
         function, the stack trace really just adds noise to the error. (I don't
         have a strong opinion on whether we should include this third commit,
         but the change was very mechanical so I thought I'd include it anyway in
         case there's interest)
      
      4. Updates tests in `array` and `stm` submodules
      
      Test Plan: ./validate, new test is T11049
      
      Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1628
      
      GHC Trac Issues: #11049
      380b25ea
  15. 03 Nov, 2015 1 commit
    • thomie's avatar
      Build system: renable -Wall on validate (base) · 987d5427
      thomie authored
      Problem: 'SRC_HC_OPTS += -Wall' in 'mk/warnings.mk' was getting
      overwritten by 'SRC_HC_OPTS = ...' in 'mk/flavours/*.mk'.
      
      It didn't affect the compiler or most other libraries, because most
      .cabal files define 'ghc-options: -Wall'.
      
      Bug introduced in commit
      2c24fd70, when moving validate settings
      from 'mk/validate-settings.mk' to 'mk/flavours/validate.mk'.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D1425
      987d5427
  16. 02 Nov, 2015 1 commit
  17. 12 Oct, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      base: MRP-refactoring of AMP instances · e737a512
      Herbert Valerio Riedel authored
      This refactors `(>>)`/`(*>)`/`return`/`pure` methods into normal form.
      
      The redundant explicit `return` method definitions are dropped
      altogether.
      
      The explicit `(>>) = (*>)` definitions can't be removed yet, as
      the default implementation of `(>>)` is still in terms of `(*>)`
      (even though that should have been changed according to the AMP but
      wasn't -- see note in GHC.Base for details why this had to be postponed)
      
      A nofib comparision shows this refactoring to result in minor runtime
      improvements (unless those are within normal measurement fluctuations):
      
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
        -------------------------------------------------------------------------
                  Min          -0.0%     -0.0%     -1.6%     -3.9%     -1.1%
                  Max          -0.0%     +0.0%     +0.5%     +0.5%      0.0%
        Geometric Mean         -0.0%     -0.0%     -0.4%     -0.5%     -0.0%
      
      Full `nofib` report at https://phabricator.haskell.org/P68
      
      Reviewers: quchen, alanz, austin, #core_libraries_committee, bgamari
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1316
      e737a512
  18. 02 Oct, 2015 1 commit