1. 11 Jan, 2019 1 commit
  2. 08 Jan, 2019 1 commit
    • Ryan Scott's avatar
      Be pickier about unsaturated synonyms in :kind · 6b70cf61
      Ryan Scott authored
      Summary:
      We currently permit any and all uses of unsaturated type
      synonyms and type families in GHCi's `:kind` command, which allows
      strange interactions like this one:
      
      ```
      > :set -XTypeFamilies -XPolyKinds
      > type family Id (a :: k)
      > type instance Id a = a
      > type Foo x = Maybe
      > :kind! Id Foo
      ```
      
      This is probably a stretch too far, so this patch moves to disallow
      unsaturated synonyms that aren't at the top level (we still want to
      allow `:kind Id`, for instance). We do this by augmenting `GhciCtxt`
      with an additional `Bool` field to indicate if we are at the
      outermost level of the type being passed to `:kind` or not. See
      `Note [Unsaturated type synonyms in GHCi]` in `TcValidity` for the
      full story.
      
      Test Plan: make test TEST=T16013
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: simonpj, goldfire, rwbarton, carter
      
      GHC Trac Issues: #16013
      
      Differential Revision: https://phabricator.haskell.org/D5471
      6b70cf61
  3. 07 Jan, 2019 1 commit
    • Alec Theriault's avatar
      Check that libs found by GCC aren't folders · 6b5ec08a
      Alec Theriault authored
      Summary:
      We use 'gcc -B<base-location> --print-file-name mylib.a' as a way of
      checking if 'gcc' can discover 'mylib.a' at the given location. However,
      this can break down if there is a folder caller 'mylib.a' that 'gcc' can
      discover. We can guard against this by explicitly checking that the path
      returned by 'gcc' is a file.
      
      This may seem like a far-fetched scenario, but since
      3d17f1f1, we look for libraries without
      any prefix or suffix (ie. 'extra-libraries: softfloat', we look for just
      'softfloat' as well as 'softloat.a', 'softfloat.dll.a', etc.) which means
      that there might actusally be a folder of that name in one of the base
      locations.
      
      Reviewers: Phyx, bgamari, hvr, angerman
      
      Reviewed By: Phyx, angerman
      
      Subscribers: angerman, rwbarton, carter
      
      GHC Trac Issues: #16063
      
      Differential Revision: https://phabricator.haskell.org/D5462
      6b5ec08a
  4. 06 Jan, 2019 3 commits
  5. 05 Jan, 2019 1 commit
  6. 04 Jan, 2019 1 commit
  7. 03 Jan, 2019 1 commit
    • My Nguyen's avatar
      Visible kind application · 17bd1635
      My Nguyen authored
      Summary:
      This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
      It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
      written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
      application, just like in term-level.
      
      There are a few remaining issues with this patch, as documented in
      ticket #16082.
      
      Includes a submodule update for Haddock.
      
      Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a
      
      Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack
      
      Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter
      
      GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`
      
      Differential Revision: https://phabricator.haskell.org/D5229
      17bd1635
  8. 01 Jan, 2019 1 commit
  9. 30 Dec, 2018 1 commit
  10. 29 Dec, 2018 1 commit
  11. 24 Dec, 2018 1 commit
    • Ömer Sinan Ağacan's avatar
      Simplify Core output with -dsuppress-type-signatures · 8a0fca09
      Ömer Sinan Ağacan authored
      Currently we duplicate top-level binder ids for no reason:
      
          $fEqHsExpr_$c/=
          $fEqHsExpr_$c/=
            = \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 ->
                case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of {
                  False -> True;
                  True -> False
                }
      
      with this patch we drop the first line when type signatures are not
      printed (-dsuppress-type-signatures, which is implied by -dsuppress-all)
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5472
      8a0fca09
  12. 22 Dec, 2018 1 commit
  13. 21 Dec, 2018 7 commits
    • Ben Gamari's avatar
      TcRnDriver: Fix haddock-like comment · 348cb218
      Ben Gamari authored
      348cb218
    • Gabor Greif's avatar
      remove option · 59f29242
      Gabor Greif authored
      59f29242
    • Simon Peyton Jones's avatar
      Fix treatment of hi-boot files and dfuns · a57d5c4d
      Simon Peyton Jones authored
      Trac #16038 exposed the fact that TcRnDriver.checkHiBootIface
      was creating a binding, in the module being compiled, for
         $fxBlah = $fBlah
      
       but $fxBlah was a /GlobalId/. But all bindings should be for
       /LocalIds/ else dependency analysis goes down the tubes.
      
      * I added a CoreLint check that an occurrence of a GlobalId
        is not bound by an binding of a LocalId.  (There is already
        a binding-site check that no binding binds a GlobalId.)
      
      * I refactored (and actually signficantly simplified) the
        tricky code for dfuns in checkHiBootIface to ensure that
        we get LocalIds for those boot-dfuns.
      
      Alas, I then got "duplicate instance" messages when compiling
      HsExpr. It turns out that this is a long-standing, but extremely
      delicate, bug: even before this patch, if you compile HsExpr
      with -ddump-tc-trace, you get "duplicate instance". Without
      -ddump-tc-trace, it's OK.  What a mess!
      
      The reason for the duplicate-instance is now explained in
      Note [Loading your own hi-boot file] in LoadIface.  I fixed
      it by a Gross Hack in LoadIface.loadInterface. This is at
      least no worse than before.
      
      But there should be a better way. I have opened #16081 for this.
      a57d5c4d
    • Simon Peyton Jones's avatar
      Tiny refactor to tcExtendRecEnv · 66ce7de1
      Simon Peyton Jones authored
      In tcExtendRecEnv, there is no need to us setGlobalTypeEnv
      (which side-effects the tcg_type_env_var).  tcExtendRecEnv
      is used only when kind-checking a group of type/class decls
      and no knot-tying via tcg_type_env_var is needed.
      
      There is no change in functionality.
      66ce7de1
    • Simon Peyton Jones's avatar
      Comments only · 28188e06
      Simon Peyton Jones authored
      28188e06
    • Simon Peyton Jones's avatar
      Make candidateQTvs contain tyvar with zonked kinds · 71e26a74
      Simon Peyton Jones authored
      candidateQTyVars was failing to return fully-zonked
      tyvars, and that made things fall over chaotically
      when we try to sort them into a well-scoped telescope.
      Result: Trac #15795
      
      So I made candidateQTvs guarantee to have fully-zonked
      tyvars (i.e. with zonked kinds).  That's a bit annoying
      but not really difficult.
      71e26a74
    • Ryan Scott's avatar
      Fix #16002 by moving a validity check to the renamer · 28f41f1a
      Ryan Scott authored
      Summary:
      The validity check which rejected things like:
      
      ```lang=haskell
      type family B x where
        A x = x
      ```
      
      Used to live in the typechecker. But it turns out that this validity
      check was //only// being run on closed type families without CUSKs!
      This meant that GHC would silently accept something like this:
      
      ```lang=haskell
      type family B (x :: *) :: * where
        A x = x
      ```
      
      This patch fixes the issue by moving this validity check to the
      renamer, where we can be sure that the check will //always// be run.
      
      Test Plan: make test TEST=T16002
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: goldfire, rwbarton, carter
      
      GHC Trac Issues: #16002
      
      Differential Revision: https://phabricator.haskell.org/D5420
      28f41f1a
  14. 20 Dec, 2018 3 commits
  15. 19 Dec, 2018 3 commits
    • Ryan Scott's avatar
      Fix #16030 by refactoring IfaceSyn's treatment of GADT constructors · 9d9e3557
      Ryan Scott authored
      Summary:
      GHCi's `:info` command was pretty-printined GADT
      constructors suboptimally in the following ways:
      
      1. Sometimes, fields were parenthesized when they did not need it,
         e.g.,
      
      ```lang=haskell
      data Foo a where
        MkFoo :: (Maybe a) -> Foo a
      ```
      
         I fixed this by refactoring some code in `pprIfaceConDecl` to be a
         little smarter with respect to GADT syntax. See `pprFieldArgTy`
         and `pprArgTy`.
      2. With `-fprint-explicit-kinds` enabled, there would be times when
         specified arguments would be printed without a leading `@` in GADT
         return types, e.g.,
      
      ```lang=haskell
      data Bar @k (a :: k) where
        MkBar :: Bar k a
      ```
      
         It turns out that `ppr_tc_app`, the function which pretty-prints
         these return types, was not using the proper machinery to print
         out the arguments, which caused the visibilities to be forgotten
         entirely. I refactored `ppr_tc_app` to do this correctly.
      
      Test Plan: make test TEST=T16030
      
      Reviewers: goldfire, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter
      
      GHC Trac Issues: #16030
      
      Differential Revision: https://phabricator.haskell.org/D5440
      9d9e3557
    • Krzysztof Gogolewski's avatar
      Use unicode arrows with -fprint-unicode-syntax · d555d4be
      Krzysztof Gogolewski authored
      Summary:
      See #8959, this is one more place where we
      can pretty-print Unicode syntax.
      
      Test Plan: validate
      
      Reviewers: nomeata, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #8959
      
      Differential Revision: https://phabricator.haskell.org/D5439
      d555d4be
    • chessai's avatar
      don't suggest Rank2Types in error messages (Fixed #16000) · de50f8fd
      chessai authored
      Summary: Rank2Types is deprecated. Don't suggest to users to use it.
      
      Reviewers: bgamari, RyanGlScott, simonpj
      
      Reviewed By: RyanGlScott, simonpj
      
      Subscribers: RyanGlScott, rwbarton, carter
      
      GHC Trac Issues: #16000
      
      Differential Revision: https://phabricator.haskell.org/D5447
      de50f8fd
  16. 17 Dec, 2018 3 commits
    • Ben Gamari's avatar
    • Gabor Greif's avatar
      Stomp a few typos and grammaros · caf50f63
      Gabor Greif authored
      Also use 'id'
      caf50f63
    • Zejun Wu's avatar
      Merge sections in profiling .a to .p_o and use it whenever it exists · de56a67a
      Zejun Wu authored
      Summary:
      We do this for vanilla way already.
      Let's also merge sections for profiling way and use it instead of the .a
      library when it exists.
      
      Test Plan:
      ```
       $ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
       GHCi, version 8.7.20180921: http://www.haskell.org/ghc/  :? for help
       Prelude> pid <- System.Posix.Process.getProcessID
       Prelude> maps <- readFile $ "/proc/" ++ show pid ++ "/maps"
       Prelude> pid
       3807346
       Prelude> putStrLn $ unlines $ take 20 $ lines maps
       00400000-02103000 r-xp 00000000 00:1a 199277344
       /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
       02104000-02106000 r--p 01d03000 00:1a 199277344
       /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
       02106000-02417000 rw-p 01d05000 00:1a 199277344
       /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
       02417000-0280a000 rw-p 00000000 00:00 0
       [heap]
       40098000-400b0000 rwxp 000d2000 00:1a 199276023
       /data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
       400b7000-400d8000 rwxp 00000000 00:00 0
       401d1000-401d2000 rwxp 000e9000 00:1a 199276023
       /data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
       40415000-40419000 rwxp 0000b000 00:1a 199275165
       /data/users/watashi/ghc/libraries/deepseq/dist-install/build/HSdeepseq-1.4.4.0.p_o
       404f8000-40526000 rwxp 000af000 00:1a 199274234
       /data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.p_o
      ```
      
      Reviewers: simonmar, bgamari, austin, hvr
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5169
      de56a67a
  17. 15 Dec, 2018 1 commit
    • Ben Gamari's avatar
      Use https links in user-facing startup and error messages · a1c0b706
      Ben Gamari authored
      I consider myself lucky that in my circle of friends, `http` urls (as
      opposed to `https` urls) are frowned upon in that we generally
      apologize in the rase cases that we share an `http` url.
      
      This pull request changes `http` links into their `https` analogues in
      the following places:
      
      * In the GHCI startup message (and parts of the User's Guide, where
      there are verbatim transcripts of GHCi sessions).
      * In a couple of error messages, asking the user to report a bug.
      
      (I also took the liberty to change a single space before the reportabug
      url into two spaces, harmonizing this occurence with the others.)
      
      I'm not trying to start a war. I just had a moment to spare and felt
      like preparing this diff. Merge or don't merge as you wish!
      
      Reviewers: bgamari, erikd, simonmar
      
      Subscribers: goldfire, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5450
      a1c0b706
  18. 14 Dec, 2018 1 commit
  19. 13 Dec, 2018 3 commits
  20. 12 Dec, 2018 3 commits
    • Simon Peyton Jones's avatar
      Remove dead code · f0eb404e
      Simon Peyton Jones authored
      This is a follow-up to
       d77501cd Improvements to demand analysis
      
      I forgot to remove some now-dead code
      f0eb404e
    • Simon Peyton Jones's avatar
      Improvements to demand analysis · d77501cd
      Simon Peyton Jones authored
      This patch collects a few improvements triggered by Trac #15696,
      and fixing Trac #16029
      
      * Stop making toCleanDmd behave specially for unlifted types.
        This special case was the cause of stupid behaviour in Trac
        #16029.  And to my joy I discovered the let/app invariant
        rendered it unnecessary.  (Maybe the special case pre-dated
        the let/app invariant.)
      
        Result: less special-case handling in the compiler, and
        better perf for the compiled code.
      
      * In WwLib.mkWWstr_one, treat seqDmd like U(AAA).  It was not
        being so treated before, which again led to stupid code.
      
      * Update and improve Notes
      
      There are .stderr test wibbles because we get slightly different
      strictness signatures for an argumment of unlifted type:
          <L,U> rather than <S,U>        for Int#
          <S,U> rather than <S(S),U(U)>  for Int
      d77501cd
    • Ömer Sinan Ağacan's avatar
      ded4a1db
  21. 11 Dec, 2018 2 commits
    • Shayne Fletcher's avatar
      Enable rebindable fail with overloaded strings · 8a4edd15
      Shayne Fletcher authored
      Summary: enable rebindable fail with overloaded strings
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, ndmitchell, rwbarton, carter
      
      GHC Trac Issues: #15645
      
      Differential Revision: https://phabricator.haskell.org/D5251
      8a4edd15
    • Zejun Wu's avatar
      Explicitly pass -fno-PIC to C compiler on linux · c98e25a4
      Zejun Wu authored
      Recent gcc on some linux ditributions may have -fPIC on by default
      
      ```
      $ uname -a
      Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
      20:45:30 CEST 2018 i686 GNU/Linux
      $ gcc --version
      gcc (GCC) 7.3.1 20180312
      $ touch dummy.c
      $ gcc -Q -v dummy.c 2>&1 | grep PIC
      options enabled:  -fPIC -fPIE -faggressive-loop-optimizations
      ```
      
      This results in following error for i686:
      
      ```
      $ TEST=T13366 make test
      ...
      c-iserv.bin:
      /home/watashi/github/ghc/libraries/ghc-prim/dist-install/build/HSghc-pri
      m-0.5.3.o:
      unknown symbol `_GLOBAL_OFFSET_TABLE_'
      ghc-stage2: unable to load package `ghc-prim-0.5.3'
      ...
      ```
      
      As our runtime linker doesn't support R_386_GOTPC relocations at all
      (#15847).
      Also while we don't have such problem on x86_64, it's not desired to
      build PIC objects either.
      
      Test Plan: `TEST=T13366 make test` passed on
      {rGHC82a716431cc680392e332bc2b1a1fd0d7faa4cd8}
      
      Reviewers: simonmar, bgamari, austin
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15848
      
      Differential Revision: https://phabricator.haskell.org/D5288
      c98e25a4