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 1 commit
    • Herbert Valerio Riedel's avatar
      Add public rnf/hash operations to TypeRep/TyCon · 56e0ac98
      Herbert Valerio Riedel authored
      Summary:
      `TyCon` and `TypeRep` are supposed to be abstract, by providing these
      additional few public operations the need to import
      `Data.Typeable.Internal` is reduced, and future changes to the internal
      structure of `TypeRep`/`TyCon` shouldn't require changes in packages such as
      `deepseq` or `hashable` anymore (hopefully).
      
      Reviewers: ekmett, simonpj, tibbe, austin
      
      Reviewed By: ekmett, simonpj, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D699
      56e0ac98
  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. 26 Feb, 2015 1 commit
  7. 23 Feb, 2015 4 commits
  8. 22 Feb, 2015 1 commit
  9. 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
  10. 17 Feb, 2015 1 commit
  11. 15 Feb, 2015 1 commit
  12. 13 Feb, 2015 1 commit
  13. 10 Feb, 2015 2 commits
  14. 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
  15. 06 Feb, 2015 1 commit
  16. 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
  17. 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
  18. 23 Jan, 2015 1 commit
  19. 22 Jan, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Restore invariant in `Data (Ratio a)` instance · 3df429e2
      Herbert Valerio Riedel authored
      (2nd attempt, this time leaving the `Constr` using `":%"`)
      
      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
      3df429e2
  20. 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
  21. 19 Jan, 2015 3 commits
    • Eric Seidel's avatar
      Expose source locations via Implicit Parameters of type GHC.Location.Location · c024af13
      Eric Seidel authored
      Summary:
      IPs with this type will always be solved for the current source
      location. If another IP of the same type is in scope, the two locations will be
      appended, creating a call-stack. The Location type is kept abstract so users
      cannot create them, but a Location can be turned into a list of SrcLocs, which
      correspond to individual locations in a program. Each SrcLoc contains a
      package/module/file name and start/end lines and columns.
      
      The only thing missing from the SrcLoc in my opinion is the name of the
      top-level definition it inhabits. I suspect that would also be useful, but it's
      not clear to me how to extract the current top-level binder from within the
      constraint solver. (Surely I'm just missing something here?)
      
      I made the (perhaps controversial) decision to have GHC completely ignore
      the names of Location IPs, meaning that in the following code:
      
          bar :: (?myloc :: Location) => String
          bar = foo
      
          foo :: (?loc :: Location) => String
          foo = show ?loc
      
      if I call `bar`, the resulting call-stack will include locations for
      
      1. the use of `?loc` inside `foo`,
      2. `foo`s call-site inside `bar`, and
      3. `bar`s call-site, wherever that may be.
      
      This makes Location IPs very special indeed, and I'm happy to change it if the
      dissonance is too great.
      
      I've also left out any changes to base to make use of Location IPs, since there
      were some concerns about a snowball effect. I think it would be reasonable to
      mark this as an experimental feature for now (it is!), and defer using it in
      base until we have more experience with it. It is, after all, quite easy to
      define your own version of `error`, `undefined`, etc. that use Location IPs.
      
      Test Plan: validate, new test-case is testsuite/tests/typecheck/should_run/IPLocation.hs
      
      Reviewers: austin, hvr, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonmar, rodlogic, carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D578
      
      GHC Trac Issues: #9049
      c024af13
    • Austin Seipp's avatar
      Revert "Add export lists to some modules." · f006ed79
      Austin Seipp authored
      This reverts commit d6e7f5dc.
      
      This commit broke the build on Windows due to CPP weirdness (#9945).
      f006ed79
    • Austin Seipp's avatar
      Revert "Fix undefined GHC.Real export with integer-simple" · e1a45810
      Austin Seipp authored
      This reverts commit 228902aa.
      
      This commit is dependent on d6e7f5dc,
      which broke the build on Windows (issue #9945).
      e1a45810
  22. 16 Jan, 2015 1 commit
    • Alexander Vershilov's avatar
      Trac #9878: Make the static form illegal in interpreted mode. · fffbf062
      Alexander Vershilov authored
      
      
      Summary:
      The entries of the static pointers table are expected to exist as
      object code. Thus we have ghci complain with an intelligible error
      message if the static form is used in interpreted mode.
      
      It also includes a fix to keysHashTable in Hash.c which could cause a
      crash. The iteration of the hashtable internals was incorrect. This
      patch has the function keysHashTable imitate the iteration in
      freeHashTable.
      
      Finally, we submit here some minor edits to comments and
      GHC.StaticPtr.StaticPtrInfo field names.
      
      Authored-by: Alexander Vershilov <alexander.vershilov@tweag.
      Authored-by: default avatarFacundo Domínguez <facundo.dominguez@tweag.io>
      
      Test Plan: ./validate
      
      Reviewers: simonpj, hvr, austin
      
      Reviewed By: austin
      
      Subscribers: carter, thomie, qnikst, mboes
      
      Differential Revision: https://phabricator.haskell.org/D586
      
      GHC Trac Issues: #9878
      fffbf062
  23. 14 Jan, 2015 1 commit
  24. 13 Jan, 2015 1 commit
  25. 12 Jan, 2015 1 commit
    • Ben Gamari's avatar
      Event Manager: Make one-shot a per-registration property · 02343998
      Ben Gamari authored
      Summary:
      Currently the event manager has a global flag for whether to create
      epoll-like notifications as one-shot (e.g. EPOLLONESHOT, where an fd
      will be deactivated after its first event) or standard multi-shot
      notifications.
      
      Unfortunately this means that the event manager may export either
      one-shot or multi-shot semantics to the user. Even worse, the user has
      no way of knowing which semantics are being delivered. This resulted in
      breakage in the usb[1] library which deadlocks after notifications on
      its fd are disabled after the first event is delivered.  This patch
      reworks one-shot event support to allow the user to choose whether
      one-shot or multi-shot semantics are desired on a per-registration
      basis. The event manager can then decide whether to use a one-shot or
      multi-shot epoll.
      
      A registration is now defined by a set of Events (as before) as well as
      a Lifetime (either one-shot or multi-shot). We lend monoidal structure
      to Lifetime choosing OneShot as the identity. This allows us to combine
      Lifetime/Event pairs of an fd to give the longest desired lifetime of
      the registration and the full set of Events for which we want
      notification.
      
      [1] https://github.com/basvandijk/usb/issues/7
      
      Test Plan: Add more test cases and validate
      
      Reviewers: tibbe, AndreasVoellmy, hvr, austin
      
      Reviewed By: austin
      
      Subscribers: thomie, carter, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D347
      02343998