1. 15 Aug, 2019 1 commit
    • James Foster's avatar
      Remove unused imports of the form 'import foo ()' (Fixes #17065) · ca71d551
      James Foster authored
      These kinds of imports are necessary in some cases such as
      importing instances of typeclasses or intentionally creating
      dependencies in the build system, but '-Wunused-imports' can't
      detect when they are no longer needed. This commit removes the
      unused ones currently in the code base (not including test files
      or submodules), with the hope that doing so may increase
      parallelism in the build system by removing unnecessary
      dependencies.
      ca71d551
  2. 06 Jan, 2019 1 commit
  3. 05 Sep, 2018 1 commit
  4. 15 Jun, 2018 1 commit
    • Sylvain Henry's avatar
      Built-in Natural literals in Core · fe770c21
      Sylvain Henry authored
      Add support for built-in Natural literals in Core.
      
      - Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
        constructor with a LitNumType field
      - Support built-in Natural literals
      - Add desugar warning for negative literals
      - Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
        reasons
      
      This patch introduces only a few rules for Natural literals (compared
      to Integer's rules). Factorization of the built-in rules for numeric
      literals will be done in another patch as this one is already big to
      review.
      
      Test Plan:
        validate
        test build with integer-simple
      
      Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
      thomie
      
      GHC Trac Issues: #14170, #14465
      
      Differential Revision: https://phabricator.haskell.org/D4212
      fe770c21
  5. 14 Jun, 2018 1 commit
    • Vladislav Zavialov's avatar
      Embrace -XTypeInType, add -XStarIsType · d650729f
      Vladislav Zavialov authored
      Summary:
      Implement the "Embrace Type :: Type" GHC proposal,
      .../ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst
      
      GHC 8.0 included a major change to GHC's type system: the Type :: Type
      axiom. Though casual users were protected from this by hiding its
      features behind the -XTypeInType extension, all programs written in GHC
      8+ have the axiom behind the scenes. In order to preserve backward
      compatibility, various legacy features were left unchanged. For example,
      with -XDataKinds but not -XTypeInType, GADTs could not be used in types.
      Now these restrictions are lifted and -XTypeInType becomes a redundant
      flag that will be eventually deprecated.
      
      * Incorporate the features currently in -XTypeInType into the
        -XPolyKinds and -XDataKinds extensions.
      * Introduce a new extension -XStarIsType to control how to parse * in
        code and whether to print it in error messages.
      
      Test Plan: Validate
      
      Reviewers: goldfire, hvr, bgamari, alanz, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #15195
      
      Differential Revision: https://phabricator.haskell.org/D4748
      d650729f
  6. 02 May, 2018 1 commit
  7. 24 Feb, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      Address #11471 by putting RuntimeRep in kinds. · d8c64e86
      eir@cis.upenn.edu authored
      See Note [TYPE] in TysPrim. There are still some outstanding
      pieces in #11471 though, so this doesn't actually nail the bug.
      
      This commit also contains a few performance improvements:
      
      * Short-cut equality checking of nullary type syns
      
      * Compare types before kinds in eqType
      
      * INLINE coreViewOneStarKind
      
      * Store tycon binders separately from kinds.
      
      This resulted in a ~10% performance improvement in compiling
      the Cabal package. No change in functionality other than
      performance. (This affects the interface file format, though.)
      
      This commit updates the haddock submodule.
      d8c64e86
  8. 01 Feb, 2016 1 commit
    • Eric Seidel's avatar
      Hide the CallStack implicit parameter · 94048f9f
      Eric Seidel authored
      The implicit parameter isn't actually very relevant to the CallStack
      machinery, so we hide the implementation details behind a constraint
      alias
      
      ```
      type HasCallStack = (?callStack :: CallStack)
      ```
      
      This has a few benefits:
      
      1. No need to enable `ImplicitParams` in user code.
      2. No need to remember the `?callStack` naming convention.
      3. Gives us the option to change the implementation details in the
      future with less user-land breakage.
      
      The revised `CallStack` API is exported from `GHC.Stack` and makes no
      mention of the implicit parameter.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1818
      94048f9f
  9. 18 Jan, 2016 1 commit
    • Eric Seidel's avatar
      un-wire-in error, undefined, CallStack, and IP · a7b751db
      Eric Seidel authored
      I missed a crucial step in the wiring-in process of `CallStack` in D861,
      the bit where you actually wire-in the Name... This led to a nasty bug
      where GHC thought `CallStack` was not wired-in and tried to fingerprint
      it, which failed because the defining module was not loaded.
      
      But we don't need `CallStack` to be wired-in anymore since `error` and
      `undefined` no longer need to be wired-in. So we just remove them all.
      
      Updates haddock submodule.
      
      Test Plan: `./validate` and `make slowtest TEST=tc198`
      
      Reviewers: simonpj, goldfire, austin, hvr, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: goldfire, thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1739
      
      GHC Trac Issues: #11331
      a7b751db
  10. 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
  11. 02 Oct, 2015 1 commit
    • Ben Gamari's avatar
      Move CallStack back to base · 74424346
      Ben Gamari authored
      CallStack requires tuples, instances of which are defined in GHC.Tuple.
      Unfortunately the change made in D757 to the `Typeable` deriving
      mechanism means that `GHC.Tuple` must import `GHC.Types` for types
      necessary to generate type representations.  This results in a cycle.
      
      Test Plan: Validate
      
      Reviewers: gridaphobe, austin, hvr
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1298
      74424346
  12. 02 Sep, 2015 1 commit
    • Eric Seidel's avatar
      Use IP based CallStack in error and undefined · 6740d70d
      Eric Seidel authored
      This patch modifies `error`, `undefined`, and `assertError` to use
      implicit call-stacks to provide better error messages to users.
      
      There are a few knock-on effects:
      
      - `GHC.Classes.IP` is now wired-in so it can be used in the wired-in
        types for `error` and `undefined`.
      
      - `TysPrim.tyVarList` has been replaced with a new function
        `TysPrim.mkTemplateTyVars`. `tyVarList` made it easy to introduce
        subtle bugs when you need tyvars of different kinds. The naive
      
        ```
        tv1 = head $ tyVarList kind1
        tv2 = head $ tyVarList kind2
        ```
      
        would result in `tv1` and `tv2` sharing a `Unique`, thus substitutions
        would be applied incorrectly, treating `tv1` and `tv2` as the same
        tyvar. `mkTemplateTyVars` avoids this pitfall by taking a list of kinds
        and producing a single tyvar of each kind.
      
      - The types `GHC.SrcLoc.SrcLoc` and `GHC.Stack.CallStack` now live in
        ghc-prim.
      
      - The type `GHC.Exception.ErrorCall` has a new constructor
        `ErrorCallWithLocation` that takes two `String`s instead of one, the
        2nd one being arbitrary metadata about the error (but usually the
        call-stack). A bi-directional pattern synonym `ErrorCall` continues to
        provide the old API.
      
      Updates Cabal, array, and haddock submodules.
      
      Reviewers: nh2, goldfire, simonpj, hvr, rwbarton, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, rodlogic, goldfire, maoe, simonmar, carter,
      liyang, bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D861
      
      GHC Trac Issues: #5273
      6740d70d
  13. 07 Nov, 2014 1 commit
  14. 22 Sep, 2013 1 commit
  15. 17 Sep, 2013 1 commit
  16. 07 Jun, 2013 1 commit
  17. 06 Jun, 2013 2 commits
    • Simon Peyton Jones's avatar
      Make GHC.Err depend on GHC.Integer · b3afa0a1
      Simon Peyton Jones authored
      GHC relies internally on GCh.Integer.Type.mkInteger from integer-gmp,
      but the dependency isn't visible to the build system, so we need to
      add it here.
      b3afa0a1
    • Simon Peyton Jones's avatar
      Re-jig SOURCE imports · 8d87b5bf
      Simon Peyton Jones authored
      * Do not have have an hs-boot file for Data.Typeable
      * Instead make all the loops go through
           GHC.Err (just a couple of magic functions)
           GHC.Exception (some non-exceptional functions)
      
      The main idea is
        a) don't involve classes in the hs-boot world
        b) loop through error cases where performance doesn't matter
        c) be careful not to SOURCE import things that are bottom,
           unless MkCore knows about them in eRROR_IDS, so that we
           see their strictness
      8d87b5bf
  18. 27 Oct, 2012 1 commit
    • ian@well-typed.com's avatar
      Remove commented types in module export lists · fda30027
      ian@well-typed.com authored
      These comments are rather less useful now that haddock can give docs
      with the same informatino in the module synopsis.
      
      Having to maintain them when making changes to the library is a pain,
      and when people forget about doing so there is nothing that checks that
      the comments are right, so mistakes tend to linger.
      
      Of the comments that my script detected, 78 of 684 were already
      incorrect in one way or another, e.g. missing context:
          Text.Show.showsPrec
          Comment type: Int -> a -> ShowS
          Actual type:  Show a => Int -> a -> ShowS
      wrong context:
          Numeric.readInt
          Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
          Actual type:  Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
      not following a class change (e.g. Num losing its Eq superclass):
          Text.Read.Lex.readOctP
          Comment type: Num a => ReadP a
          Actual type:  (Eq a, Num a) => ReadP a
      not following the Exceptions change:
          GHC.Conc.childHandler
          Comment type: Exception -> IO ()
          Actual type:  SomeException -> IO ()
      or just always been wrong:
          GHC.Stable.deRefStablePtr
          Comment type: StablePtr a -> a
          Actual type:  StablePtr a -> IO a
      fda30027
  19. 04 Jul, 2012 1 commit
  20. 28 Feb, 2012 1 commit
  21. 18 Jun, 2011 1 commit
  22. 28 Jan, 2011 1 commit
  23. 05 Aug, 2008 3 commits
  24. 01 Aug, 2008 1 commit
  25. 30 Jul, 2008 1 commit
  26. 21 Jun, 2008 1 commit
  27. 16 Jun, 2008 1 commit
  28. 05 Mar, 2008 1 commit
  29. 20 Jan, 2008 1 commit
  30. 15 Jan, 2007 1 commit
  31. 03 Feb, 2005 1 commit
  32. 11 Jan, 2005 1 commit
  33. 26 Jul, 2004 1 commit
  34. 18 Sep, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-09-18 11:32:43 by simonmar] · a938d527
      simonmar authored
      Sort out the divide-by-zero situation.
      
      Some integer division operations called error on a divide by zero, and
      some didn't test for it.  Now we always raise the DivideByZero
      exception.
      
      MERGE TO STABLE
      a938d527
  35. 18 Jun, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-06-18 13:58:22 by simonpj] · 301802f9
      simonpj authored
      ---------------------------------------
      	    Rehash the handling of SeqOp
      	---------------------------------------
      
      See the comments in the commentary (Cunning Prelude Code).
      
      * Expunge SeqOp altogether
      
      * Add GHC.Base.lazy :: a -> a
        to GHC.Base
      
      * Add GHC.Base.lazy
        to basicTypes/MkId.  The idea is that this defn will over-ride
        the info from GHC.Base.hi, thereby hiding strictness and
        unfolding
      
      * Make stranal/WorkWrap do a "manual inlining" for GHC.Base.lazy
        This happens nicely after the strictness analyser has run.
      
      * Expunge the SeqOp/ParOp magic in CorePrep
      
      * Expunge the RULE for seq in PrelRules
      
      * Change the defns of pseq/par in GHC.Conc to:
      
      	{-# INLINE pseq  #-}
             	pseq :: a -> b -> b
             	pseq  x y = x `seq` lazy y
      
             	{-# INLINE par  #-}
             	par :: a -> b -> b
             	par  x y = case (par# x) of { _ -> lazy y }
      301802f9
  36. 09 May, 2002 1 commit
  37. 26 Apr, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-04-26 12:48:16 by simonmar] · f478c5a4
      simonmar authored
      - Add proper module headers to these guys
      - Remove \$Id\$
      - Update copyrights
      - Int.lhs and Word.lhs were just wrapped in \begin{code}..\end{code},
        so make them .hs files instead.
      f478c5a4