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. 04 Sep, 2017 1 commit
  3. 17 Aug, 2017 3 commits
  4. 14 Mar, 2017 1 commit
  5. 13 Mar, 2017 1 commit
  6. 10 Mar, 2017 1 commit
  7. 09 Mar, 2017 1 commit
  8. 06 Mar, 2017 2 commits
  9. 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
  10. 04 Feb, 2017 1 commit
    • Takenobu Tani's avatar
      Fix comment (old filename '.lhs') in libraries/ · 4d31880a
      Takenobu Tani authored
      [skip ci]
      
      There are some old file names (*.lhs) at comments.
      (I'm fixing to read source code by newcomers.)
      
      * libraries/base/GHC/Base.hs
        - compiler/deSugar/DsListComp.lhs
        - PrelRules.lhs x2
        - Base.lhs
      
      * libraries/base/GHC/IO.hs
        - PrimOp.lhs
        - GHC.IO.lhs
        - GHC.Exception.lhs
      
      * libraries/base/GHC/Real.hs
        - compiler/prelude/PrelRules.lhs
      
      * libraries/ghc-prim/GHC/Magic.hs
        - MkId.lhs x2
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3060
      4d31880a
  11. 10 Jan, 2017 1 commit
    • takano-akio's avatar
      Mark *FB functions INLINE[0] (Fixes #13001) · 09bce7ac
      takano-akio authored
      When fusion rules successfully fire, we are left with calls to
      *FB functions. They are higher-order functions, and therefore they
      often benefit from inlining. This is particularly important when
      then final consumer is a strict fold (foldl', length, etc.), because
      not inlining these functions means allocating a function closure
      for each element in the list, which often is more costly than what
      fusion eliminates.
      
      Nofib shows a slight increase in the binary size:
      
      ------------------------------------------------------------------------
             Program           Size    Allocs   Runtime   Elapsed  TotalMem
      ------------------------------------------------------------------------
         gen_regexps          -0.3%      0.0%     0.000     0.000      0.0%
              puzzle          +0.8%      0.0%     0.089     0.090      0.0%
             reptile          +0.8%     -0.0%     0.008     0.008      0.0%
      ------------------------------------------------------------------------
                 Min          -0.3%     -0.0%     -7.3%     -7.1%      0.0%
                 Max          +0.8%     +0.0%     +7.8%     +7.7%     +1.8%
      Geometric Mean          +0.0%     -0.0%     +0.2%     +0.2%     +0.0%
      ------------------------------------------------------------------------
      
      Reviewers: simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2951
      
      GHC Trac Issues: #13001
      09bce7ac
  12. 03 Jan, 2017 1 commit
    • Matthew Pickering's avatar
      Don't use $ in the definition of (<**>) in GHC.Base · 683ed475
      Matthew Pickering authored
      ($) is special as Richard explains in the note at the top of the page.
      
      However, when adding the note he didn't remove this usage. Normally it
      didn't cause any problems as the optimiser optimised it away. However if
      one had the propensity to stick one's fingers into the depths of the
      inliner, it caused horrible idInfo panics.
      
      Reviewers: rwbarton, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2913
      
      GHC Trac Issues: #13055
      683ed475
  13. 09 Oct, 2016 1 commit
  14. 24 Sep, 2016 1 commit
    • Joachim Breitner's avatar
      Replace INLINEABLE by INLINABLE (#12613) · 68f72f10
      Joachim Breitner authored
      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.
      68f72f10
  15. 18 Jul, 2016 1 commit
  16. 06 Jun, 2016 1 commit
    • seraphime's avatar
      Add @since annotations to base instances · a90085bd
      seraphime authored
      Add @since annotations to instances in `base`.
      
      Test Plan:
       * ./validate  # some commets shouldn't break the build
       * review the annotations for absurdities.
      
      Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari
      
      Reviewed By: RyanGlScott, hvr, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2277
      
      GHC Trac Issues: #11767
      a90085bd
  17. 08 Apr, 2016 1 commit
  18. 29 Jan, 2016 1 commit
  19. 04 Jan, 2016 1 commit
  20. 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
  21. 16 Dec, 2015 1 commit
    • Herbert Valerio Riedel's avatar
      Start using `-W` instead of `-f(no-)warn` in some places · 437ebdda
      Herbert Valerio Riedel authored
      This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
      introduced via 2206fa8c / #11218, in cases which are guaranteed
      to be invoked with recent enough GHC (i.e. the stage1+ GHC).
      
      After this commit, mostly the compiler and the testsuite remain using
      `-f(wo-)warn...` because the compiler needs to be bootstrappable with
      older GHCs, while for the testsuite it's convenient to be able to quickly
      compare the behavior to older GHCs (which may not support the new flags yet).
      
      The compiler-part can be updated to use the new flags once GHC 8.3 development
      starts.
      
      Reviewed By: quchen
      
      Differential Revision: https://phabricator.haskell.org/D1637
      437ebdda
  22. 11 Dec, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Add kind equalities to GHC. · 67465497
      eir@cis.upenn.edu authored
      This implements the ideas originally put forward in
      "System FC with Explicit Kind Equality" (ICFP'13).
      
      There are several noteworthy changes with this patch:
       * We now have casts in types. These change the kind
         of a type. See new constructor `CastTy`.
      
       * All types and all constructors can be promoted.
         This includes GADT constructors. GADT pattern matches
         take place in type family equations. In Core,
         types can now be applied to coercions via the
         `CoercionTy` constructor.
      
       * Coercions can now be heterogeneous, relating types
         of different kinds. A coercion proving `t1 :: k1 ~ t2 :: k2`
         proves both that `t1` and `t2` are the same and also that
         `k1` and `k2` are the same.
      
       * The `Coercion` type has been significantly enhanced.
         The documentation in `docs/core-spec/core-spec.pdf` reflects
         the new reality.
      
       * The type of `*` is now `*`. No more `BOX`.
      
       * Users can write explicit kind variables in their code,
         anywhere they can write type variables. For backward compatibility,
         automatic inference of kind-variable binding is still permitted.
      
       * The new extension `TypeInType` turns on the new user-facing
         features.
      
       * Type families and synonyms are now promoted to kinds. This causes
         trouble with parsing `*`, leading to the somewhat awkward new
         `HsAppsTy` constructor for `HsType`. This is dispatched with in
         the renamer, where the kind `*` can be told apart from a
         type-level multiplication operator. Without `-XTypeInType` the
         old behavior persists. With `-XTypeInType`, you need to import
         `Data.Kind` to get `*`, also known as `Type`.
      
       * The kind-checking algorithms in TcHsType have been significantly
         rewritten to allow for enhanced kinds.
      
       * The new features are still quite experimental and may be in flux.
      
       * TODO: Several open tickets: #11195, #11196, #11197, #11198, #11203.
      
       * TODO: Update user manual.
      
      Tickets addressed: #9017, #9173, #7961, #10524, #8566, #11142.
      Updates Haddock submodule.
      67465497
  23. 14 Nov, 2015 1 commit
  24. 03 Nov, 2015 2 commits
  25. 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
  26. 28 Jul, 2015 1 commit
    • Simon Peyton Jones's avatar
      Fallout from more assiduous RULE warnings · a1dd7dd6
      Simon Peyton Jones authored
      GHC now warns if rules compete, so that it's not predicatable
      which will work and which will not. E.g.
      
      {-# RULES
        f (g x) = ...
        g True  = ...
        #-}
      
      If we had (f (g True)) it's not clear which rule would fire.
      
      This showed up fraility in the libraries.
      
      * Suppress warnigns in Control.Arrow, Control.Category for class
        methods. At the moment we simply don't have a good way to write a
        RULE with a class method in the LHS.  See Trac #1595.  Arrow and
        Category attempt to do so; I have silenced the complaints with
        -fno-warn-inline-rule-shadowing, but it's not a great solution.
      
      * Adjust the NOINLINE pragma on 'GHC.Base.map' to account for the
        map/coerce rule
      
      * Adjust the rewrite rules in Enum, especially for the "literal 1"
        case.  See Note [Enum Integer rules for literal 1].
      
      * Suppress warnings for 'bytestring' e.g.
         libraries/bytestring/Data/ByteString.hs:895:1: warning:
            Rule "ByteString specialise break (x==)" may never fire
              because rule "Class op ==" for ‘==’ might fire first
            Probable fix: add phase [n] or [~n] to the competing rule
      a1dd7dd6
  27. 16 Jun, 2015 1 commit
  28. 06 Apr, 2015 1 commit
  29. 25 Mar, 2015 1 commit
  30. 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
  31. 19 Jan, 2015 1 commit
  32. 28 Dec, 2014 1 commit
  33. 16 Dec, 2014 1 commit
  34. 18 Nov, 2014 1 commit
  35. 13 Nov, 2014 2 commits