1. 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
  2. 18 Jul, 2016 1 commit
  3. 06 Jun, 2016 1 commit
  4. 08 Apr, 2016 1 commit
  5. 29 Jan, 2016 1 commit
  6. 04 Jan, 2016 1 commit
  7. 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
  8. 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
  9. 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
  10. 14 Nov, 2015 1 commit
  11. 03 Nov, 2015 2 commits
  12. 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
  13. 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
  14. 16 Jun, 2015 1 commit
  15. 06 Apr, 2015 1 commit
  16. 25 Mar, 2015 1 commit
  17. 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
  18. 19 Jan, 2015 1 commit
  19. 28 Dec, 2014 1 commit
  20. 16 Dec, 2014 1 commit
  21. 18 Nov, 2014 1 commit
  22. 13 Nov, 2014 2 commits
  23. 11 Nov, 2014 1 commit
    • David Feuer's avatar
      Define list monad operations using comprehensions · 4923cea5
      David Feuer authored
      Define list monad operations using list comprehensions. Code using monad
      operations with lists did not fuse fully. Writing list code with `do`
      notation or `(>>=)` and `(>>)` operations could allocate more than
      equivalent code using list comprehensions.
      
      Define `mapM` directly, instead of using `sequence` and `map`. This
      leads to substantially less allocation in `cryptarithm2`.
      
      Addresses #9781
      
      Reviewed By: ekmett, nomeata
      
      Differential Revision: https://phabricator.haskell.org/D455
      4923cea5
  24. 07 Nov, 2014 3 commits
    • Herbert Valerio Riedel's avatar
      base: Manually unlit .lhs into .hs modules · df3b1d43
      Herbert Valerio Riedel authored
      This commit mostly converts literate comments into ordinary
      Haskell comments or sometimes even Haddock comments, while also
      removing literate comments in a few cases where they don't make
      much sense anymore.
      
      Moreover, in a few cases trailing whitespaces were removed as well.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D456
      df3b1d43
    • David Feuer's avatar
      Make getTag use a bang pattern instead of seq · dc5fa804
      David Feuer authored
      It's prettier that way, and there's less risk of anything
      going sideways.
      
      Reviewed By: hvr, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D450
      dc5fa804
    • David Feuer's avatar
      Improve Applicative definitions · abba3812
      David Feuer authored
      Generally clean up things relating to Applicative and Monad in `GHC.Base`
      and `Control.Applicative` to make `Applicative` feel like a bit more of a
      first-class citizen rather than just playing second fiddle to `Monad`. Use
      `coerce` and GND to improve performance and clarity.
      
      Change the default definition of `(*>)` to use `(<$)`, in case the
      `Functor` instance optimizes that.
      
      Moreover, some manually written instances are made into compiler-derived
      instances.
      
      Finally, this also adds a few AMP-related laws to the `Applicative` docstring.
      
      NOTE: These changes result in a 13% decrease in allocation for T9020
      
      Reviewed By: ekmett, hvr
      
      Differential Revision: https://phabricator.haskell.org/D432
      abba3812
  25. 04 Nov, 2014 2 commits
    • Herbert Valerio Riedel's avatar
      Remove redundant "Minimal complete definition"-comments · 1408c8dc
      Herbert Valerio Riedel authored
      Those manual descriptions in Haddock strings have become redundant since
      Haddock gained the ability to print the minimal complete definition as
      specified via `{-# MINIMAL #-}` annotation (or otherwise inferred by
      GHC).
      
      Moreover, this commit moves all `{-# MINIMAL #-}` annotations in `base`
      to the start of the respective `class` definitions, as this is more
      readable and matches more closely the way Haddock renders that
      information.
      1408c8dc
    • Herbert Valerio Riedel's avatar
      Fix lost Haddock annotation for `class Monad m` · c7fa0ba6
      Herbert Valerio Riedel authored
      This was broken in d94de872 when `join`
      was inserted between `Monad`'s Haddock string and the `class Monad m`
      definition thereby breaking the association.
      c7fa0ba6
  26. 01 Oct, 2014 1 commit
    • David Feuer's avatar
      Fusion rule for "foldr k z (x:build g)" · 78932109
      David Feuer authored
      There seem to be various issues with general fold/cons and even
      cons/build rules, but it seems pretty clear to me that the simple
      fold/cons/build rule is a good idea. It doesn't do much for nofib
      allocation, but it seems to improve some other analyses and speed
      several benchmarks up. Implements #9536.
      78932109
  27. 28 Sep, 2014 1 commit
  28. 24 Sep, 2014 1 commit
  29. 21 Sep, 2014 1 commit
  30. 18 Sep, 2014 3 commits
  31. 16 Sep, 2014 2 commits
  32. 15 Sep, 2014 1 commit