1. 07 Mar, 2015 5 commits
    • Herbert Valerio Riedel's avatar
      base: drop redundant Typeable derivings · 47b5b5c2
      Herbert Valerio Riedel authored
      Thanks to #9858 `Typeable` doesn't need to be explicitly derived anymore.
      This also makes `AutoDeriveTypeable` redundant, as well as some imports of
      `Typeable` (removal of whose may be beneficial to #9707). This commit
      removes several such now redundant use-sites in `base`.
      
      Reviewed By: austin, ekmett
      
      Differential Revision: https://phabricator.haskell.org/D712
      47b5b5c2
    • Iavor S. Diatchki's avatar
      Custom `Typeable` solver, that keeps track of kinds. · b359c886
      Iavor S. Diatchki authored
      Summary:
      This implements the new `Typeable` solver: when GHC sees `Typeable` constraints
      it solves them on the spot.
      
      The current implementation creates `TyCon` representations on the spot.
      
      Pro: No overhead at all in code that does not use `Typeable`
      Cons: Code that uses `Typeable` may create multipe `TyCon` represntations.
      
      We have discussed an implementation where representations of `TyCons` are
      computed once, in the module, where a datatype is declared.  This would
      lead to more code being generated:  for a promotable datatype we need to
      generate `2 + number_of_data_cons` type-constructro representations,
      and we have to do that for all programs, even ones that do not intend to
      use typeable.
      
      I added code to emit warning whenevar `deriving Typeable` is encountered---
      the idea being that this is not needed anymore, and shold be fixed.
      
      Also, we allow `instance Typeable T` in .hs-boot files, but they result
      in a warning, and are ignored.  This last one was to avoid breaking exisitng
      code, and should become an error, eventually.
      
      Test Plan:
      1. GHC can compile itself.
      2. I compiled a number of large libraries, including `lens`.
          - I had to make some small changes:
            `unordered-containers` uses internals of `TypeReps`, so I had to do a 1 line fix
          - `lens` needed one instance changed, due to a poly-kinded `Typeble` instance
      
      3. I also run some code that uses `syb` to traverse a largish datastrucutre.
      I didn't notice any signifiant performance difference between the 7.8.3 version,
      and this implementation.
      
      Reviewers: simonpj, simonmar, austin, hvr
      
      Reviewed By: austin, hvr
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D652
      
      GHC Trac Issues: #9858
      b359c886
    • Herbert Valerio Riedel's avatar
      Re-export `<$` from Prelude (#10113) · 479523f3
      Herbert Valerio Riedel authored
      This is a follow-up to eb3661f2
      re-exporting `<$` from `Prelude` as well.
      
      Reviewed By: austin, ekmett
      
      Differential Revision: https://phabricator.haskell.org/D681
      479523f3
    • Herbert Valerio Riedel's avatar
      Re-export `<$>` from Prelude (#10113) · eb3661f2
      Herbert Valerio Riedel authored
      Whether to re-export the `<$>` non-method operator from `Prelude` wasn't
      explicitly covered in the original AMP proposal[1], but it turns out that
      not doing so forces most code that makes use of applicatives to import
      `Data.Functor` or `Control.Applicative` just to get that operator into
      scope.  To this end, it was proposed to add `<$>` to Prelude as well[2].
      
      The down-side is that this increases the amount of redundant-import
      warnings triggered, as well as the relatively minor issue of stealing
      the `<$>` operator from the default namespace for good (although at this
      point `<$>` is supposed to be ubiquitous anyway due to `Applicative`
      being implicitly required into the next Haskell Report)
      
       [1]: https://wiki.haskell.org/Functor-Applicative-Monad_Proposal
       [2]: http://thread.gmane.org/gmane.comp.lang.haskell.libraries/24161
      
      Reviewed By: austin, ekmett
      
      Differential Revision: https://phabricator.haskell.org/D680
      eb3661f2
    • Herbert Valerio Riedel's avatar
      Drop redundant LANGUAGE pragmas · 1965202f
      Herbert Valerio Riedel authored
      Due to refactoring & cleanups those pragmas have become redundant by now
      1965202f
  2. 05 Mar, 2015 2 commits
  3. 04 Mar, 2015 1 commit
    • Simon Peyton Jones's avatar
      A raft of small changes associated with -XConstrainedClassMethods · f66e0e69
      Simon Peyton Jones authored
      See Trac #7854.  Specifically:
      
      * Major clean up and simplification of check_op in checkValidClass;
        specifically
           - use checkValidType on the entire method-selector type to detect
             ambiguity
           - put a specific test for -XConstrainedClassMethods
      
      * Make -XConstrainedClassMethods be implied by -XMultiParamTypeClasses
        (a bit ad-hoc but see #7854), and document in the user manual.
      
      * Do the checkAmbiguity test just once in TcValidity.checkValidType,
        rather than repeatedly at every level. See Note [When to call checkAmbiguity]
      
      * Add -XAllowAmbiguousTypes in GHC.IP, since 'ip' really is ambiguous.
        (It's a rather magic function.)
      
      * Improve location info for check_op in checkValidClass
      
      * Update quite a few tests, which had genuinely-ambiguous class
        method signatures.  Some I fixed by making them unambiguous; some
        by adding -XAllowAmbiguousTypes
      f66e0e69
  4. 03 Mar, 2015 1 commit
    • Oleg Grenrus's avatar
      Add various instances to newtypes in Data.Monoid · 4e6bcc2c
      Oleg Grenrus authored
      Summary:
      Add Functor instances for Dual, Sum and Product
      Add Foldable instances for Dual, Sum and Product
      Add Traversable instances for Dual, Sum and Product
      Add Foldable and Traversable instances for First and Last
      Add Applicative, Monad instances to Dual, Sum, Product
      Add MonadFix to Data.Monoid wrappers
      Derive Data for Identity
      Add Data instances to Data.Monoid wrappers
      Add Data (Alt f a) instance
      
      Reviewers: ekmett, dfeuer, hvr, austin
      
      Reviewed By: dfeuer, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D673
      
      GHC Trac Issues: #10107
      4e6bcc2c
  5. 02 Mar, 2015 2 commits
  6. 27 Feb, 2015 1 commit
  7. 26 Feb, 2015 1 commit
  8. 24 Feb, 2015 2 commits
  9. 23 Feb, 2015 4 commits
  10. 22 Feb, 2015 1 commit
  11. 18 Feb, 2015 2 commits
    • PHO's avatar
      Do not clobber CPPFLAGS nor LDFLAGS, fixes #10093 · 9caf71a8
      PHO authored
      Summary: Append -I/-L flags to CPPFLAGS/LDFLAGS instead of clobbering.
      
      Test Plan: Install libiconv into /some/non-standard/path. Set CONF_GCC_LINKER_OPTS_STAGE{0,1,2} to -Wl,-rpath,/some/non-standard/path/lib. And then run ./configure with arguments --with-iconv-includes=/some/non-standard/path/include and --with-iconv-libraries=/some/non-standard/path/lib
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: thomie, PHO
      
      Differential Revision: https://phabricator.haskell.org/D663
      
      GHC Trac Issues: #10093
      9caf71a8
    • Austin Seipp's avatar
      Revert "Eta-expand argument to foldr in mapM_ for []" · 91d95305
      Austin Seipp authored
      This change lacked justification (or a test!) for its improvements, and
      I merged it on a sweep of Phabricator without fixing this. Trac #10034.
      
      This reverts commit 7cf87fc6.
      91d95305
  12. 17 Feb, 2015 1 commit
  13. 15 Feb, 2015 1 commit
  14. 13 Feb, 2015 1 commit
  15. 10 Feb, 2015 2 commits
  16. 09 Feb, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Provide default implementation of `Monad(return)` · a741e69a
      Herbert Valerio Riedel authored
      This was dropped last-minute from d94de872
      (re #4834) together with the default implementation for `(>>)`
      (see 65f887e1 for explanation).
      
      However, the risk of accidental mutually recursive definitions of
      `return`/`pure` is rather low as unlike with the `(>>) = (*>)` default,
      any cyclic definitions would necessarily wind up being new ones, rather
      than changing the semantics for old operations and introducing bottoms.
      
      On the other hand, not having the default method implementation in place
      in GHC 7.10 would complicate/delay any future attempt to clean-up the
      `Monad`-class.
      
      This finally allows (for `base >= 4.8`) to define a F/A/M instance-chain
      with the following minimal definitions (while ignoring that `return` is
      still a class-method in `Monad`)
      
        instance Functor M where
          fmap  = ...
      
        instance Applicative M where
          pure  = ...
          (<*>) = ...
      
        instance Monad M where
          (>>=) = ...
      
      Reviewed By: ekmett, austin
      
      Differential Revision: https://phabricator.haskell.org/D647
      a741e69a
  17. 06 Feb, 2015 2 commits
  18. 05 Feb, 2015 3 commits
    • David Feuer's avatar
      Eta-expand argument to foldr in mapM_ for [] · 7cf87fc6
      David Feuer authored
      Summary:
      This improves performance, at least sometimes--the previous
      implementation can be worse than the version in base 4.7. I
      have not had the time to run benchmarks and such, but `mapM`
      already does this.
      
      Also, inline `mapM_`, like `mapM`.
      
      Reviewers: hvr, nomeata, ekmett, austin
      
      Reviewed By: ekmett, austin
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D632
      
      GHC Trac Issues: #10034
      7cf87fc6
    • Oleg Grenrus's avatar
      Add packageName to GHC.Generics.Datatype · ae39c5c0
      Oleg Grenrus authored
      Summary: Added packageName to GHC.Generics.Datatype class definition
      
      Reviewers: hvr, dreixel, austin
      
      Reviewed By: dreixel, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D631
      
      GHC Trac Issues: #10030
      ae39c5c0
    • kgardas's avatar
      fix _FILE_OFFSET_BITS redefined warning on Solaris/i386 platform · 78216e22
      kgardas authored
      Summary:
      The problem with Solaris is that system header files include
      /usr/include/sys/feature_tests.h header file and it tests if
      _FILE_OFFSET_BITS define is defined. If not, it defines it to 32
      which is in conflict with 64 which we need for large file support.
      The solution is easy, always include own header files before system header
      files.
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D644
      78216e22
  19. 02 Feb, 2015 1 commit
    • AndreasVoellmy's avatar
      Fix #10017 · 92c93544
      AndreasVoellmy authored
      Summary:
      In the threaded RTS, a signal is delivered from the RTS to Haskell
      user code by writing to file that one of the IO managers watches (via
      an instance of GHC.Event.Control.Control). When the IO manager
      receives the signal, it calls GHC.Conc.Signal.runHandlers to invoke
      Haskell signal handler. In the move from a single IO manager to one IO
      manager per capability, the behavior was (wrongly) extended so that a
      signal is delivered to every event manager (see #9423), each of which
      invoke Haskell signal handlers, leading to multiple invocations of
      Haskell signal handlers for a single signal. This change fixes this
      problem by having the RTS (in generic_handler()) notify only the
      Control instance used by the TimerManager, rather than all the
      per-capability IO managers.
      
      Reviewers: austin, hvr, simonmar, Mikolaj
      
      Reviewed By: simonmar, Mikolaj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D641
      92c93544
  20. 23 Jan, 2015 1 commit
  21. 22 Jan, 2015 3 commits
  22. 21 Jan, 2015 2 commits
    • Herbert Valerio Riedel's avatar
      Revert "Restore invariant in `Data (Ratio a)` instance" · 22c4d60b
      Herbert Valerio Riedel authored
      This reverts commit 79b0d0e6
      due to
      
        Compile failed (status 256) errors were:
        [1 of 2] Compiling A                ( A.hs, A.o )
        [2 of 2] Compiling Main             ( T4491.hs, T4491.o )
        T4491.hs:19:11:
          Illegal data constructor name: ‘%’
          When splicing a TH expression: (GHC.Real.%) 11 2
          In the splice: $(dataToExpQ (const Nothing) (5.5 :: Rational))
        *** unexpected failure for T4491(normal)
      
      Therefore re-opening #10011
      22c4d60b
    • Herbert Valerio Riedel's avatar
      Restore invariant in `Data (Ratio a)` instance · 79b0d0e6
      Herbert Valerio Riedel authored
      The Data instance for `Ratio` just uses the raw `:%` constructor and
      doesn't check that the result is reduced to normal form.
      
      The fix is to add back the `Integral` constraint on the Data
      instance (which was dropped in c409b6f3) and to use `%` rather
      than `:%` in the `gfoldl` and `gunfold` implementation.
      
      This restores the invariant and matches the behavior of "virtual
      constructors" we've used to patch up such problems elsewhere.
      
      This addresses #10011
      
      Reviewed By: ekmett, austin
      
      Differential Revision: https://phabricator.haskell.org/D625
      79b0d0e6