Skip to content
Snippets Groups Projects
  1. May 26, 2017
    • Simon Peyton Jones's avatar
      Re-engineer Given flatten-skolems · 8dc6d645
      Simon Peyton Jones authored
      The big change here is to fix an outright bug in flattening of Givens,
      albeit one that is very hard to exhibit.  Suppose we have the constraint
          forall a. (a ~ F b) => ..., (forall c. ....(F b)...) ...
      
      Then
       - we'll flatten the (F) b to a fsk, say  (F b ~ fsk1)
       - we'll rewrite the (F b) inside the inner implication to 'fsk1'
       - when we leave the outer constraint we are suppose to unflatten;
         but that fsk1 will still be there
       - if we re-simplify the entire outer implication, we'll re-flatten
         the Given (F b) to, say, (F b ~ fsk2)
      Now we have two fsks standing for the same thing, and that is very
      wrong.
      
      Solution: make fsks behave more like fmvs:
       - A flatten-skolem is now a MetaTyVar, whose MetaInfo is FlatSkolTv
       - We "fill in" that meta-tyvar when leaving the implication
       - The old FlatSkol form of TcTyVarDetails is gone completely
       - We track the flatten-skolems for the current implication in
         a new field of InertSet, inert_fsks.
      
      See Note [The flattening story] in TcFlatten.
      
      In doing this I found various other things to fix:
      
      * I removed the zonkSimples from TcFlatten.unflattenWanteds; it wasn't
        needed.   But I added one in TcSimplify.floatEqualities, which does
        the zonk precisely when it is needed.
      
      * Trac #13674 showed up a case where we had
           - an insoluble Given,   e.g.  a ~ [a]
           - the same insoluble Wanted   a ~ [a]
        We don't use the Given to rewwrite the Wanted (obviously), but
        we therefore ended up reporting
            Can't deduce (a ~ [a]) from (a ~ [a])
        which is silly.
      
        Conclusion: when reporting errors, make the occurs check "win"
        See Note [Occurs check wins] in TcErrors
      8dc6d645
    • Simon Peyton Jones's avatar
      Make isInsolubleOccursCheck more aggressive · c2eea089
      Simon Peyton Jones authored
      Consider
        type family F a :: * -> *
      
      Then (a ~ F Int a) is an insoluble occurs check, and can be reported
      as such.  Previous to this patch, TcType.isInsolubleOccursCheck was
      treating any type-family application (including an over-saturated one)
      as unconditionally not-insoluble.
      
      This really only affects error messages, and then only slightly. I
      tripped over this when investigating  Trac #13674.
      c2eea089
    • Simon Peyton Jones's avatar
      A bit more tc-tracing · 17055da1
      Simon Peyton Jones authored
      17055da1
  2. May 25, 2017
    • Sergei Trofimovich's avatar
      rules: add per-library EXTRA_HC_OPTS · f011f587
      Sergei Trofimovich authored
      
      Sometimes it's handy to change a compiler flag
      for a library in stage{0,1,2}.
      
      Usage example:
      
          libraries/binary_EXTRA_HC_OPTS += -O1
          libraries/containers_EXTRA_HC_OPTS += -O1
          libraries/bytestring_EXTRA_HC_OPTS += -O1
      
      Here override default -O2 defined in .cabal files
      for these libraries to speed build up.
      
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      f011f587
    • Simon Peyton Jones's avatar
      Pattern synonyms and higher rank types · c9977385
      Simon Peyton Jones authored
      This patch fixes two separate bugs which contributed to making
      Trac #13752 go wrong
      
      1.  We need to use tcSubType, not tcUnify,
          in tcCheckPatSynDecl.tc_arg.
      
          Reason: Note [Pattern synonyms and higher rank types]
      
      2.  TcUnify.tc_sub_type had a special case designed to improve error
          messages; see Note [Don't skolemise unnecessarily].  But the
          special case was too liberal, and ended up using unification
          (which led to rejecting the program) when it should instead taken
          the normal path (which accepts the program).
      
          I fixed this by making the test more conservative.
      c9977385
    • Simon Peyton Jones's avatar
      Comments only · 10131947
      Simon Peyton Jones authored
      10131947
  3. May 23, 2017
    • Gabor Greif's avatar
      Typos in comments and manual [ci skip] · 0b4b4a34
      Gabor Greif authored
      0b4b4a34
    • Ben Gamari's avatar
    • Ben Gamari's avatar
      base: Fix a few TODOs in Typeable.Internal · 6166b59f
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      Test Plan: Validate
      
      Reviewers: austin, hvr, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13746
      
      Differential Revision: https://phabricator.haskell.org/D3605
      6166b59f
    • Sergei Trofimovich's avatar
      ghc.mk: rename installed ghc-stage1 on non-windows · 10760105
      Sergei Trofimovich authored
      
      When user installs _native_ build ghc executable is renamed
      from '$(libexec)/bin/ghc-stage<N>' to '$(libexec)/bin/ghc'.
      But not on windows!
      
      In case of _cross-compiler_ rename should happen only
      for '$(libexec)/bin/ghc-stage<N>' runnable on non-windows
      platform.
      
      Before the change '$(libexec)/bin/ghc-stage<N>' rename happened
      for any compiler not targeting windows.
      
      After the patch rename also happens for '$(libexec)/bin/ghc-stage1'
      cross-compiler built for linux targeting windows (Stage1Only=YES case).
      
      Or on a concrete example:
      
         # host is x86_64-pc-linux-gnu
         $ ./configure --target=i686-w64-mingw32
         $ make install Stage1Only=YES
      
      Before the change the layout was:
         - '$(libexec)/bin/ghc-stage1' was installed
         - bin/ghc contained 'exec $(libexec)/bin/ghc' # missing file!
      After the change:
         - '$(libexec)/bin/ghc' was installed
         - bin/ghc contained 'exec $(libexec)/bin/ghc' # present file
      
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      10760105
    • Sergei Trofimovich's avatar
      mk/config.mk.in: lower -O2 optimization down to -O1 on UNREG · 432a1f18
      Sergei Trofimovich authored
      
      It's not a new behaviour. First it was introduced by
      2d5372cf
      ("lower -O2 optimization down to -O1 on UNREG") to fix build
      failure on unregisterised powerpc64.
      
      This time I've noticed build failures on unregisterised ia64.
      
      The change was accidentally reverted by commit
      14d0f7f1
      ("Build system: Add stage specific SRC_HC_(WARNING_)OPTS)
      
      The revert happened due to the following code rearrangement:
      
          ifeq "$(GhcUnregisterised)" "YES"
          GhcStage1HcOpts=
          GhcStage2HcOpts=
          GhcStage3HcOpts=
          endif
      
          GhcUnregisterised=@Unregisterised@
      
      As a result 'ifeq' part has no effect.
      
      The change moves 'ifeq' down to the very end of file
      and adds a note it depends on the 'GhcUnregisterised' variable.
      
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      432a1f18
    • Sergei Trofimovich's avatar
      aclocal.m4: allow override of dllwrap and windres when cross-compiling · 1fd06de4
      Sergei Trofimovich authored
      
      Commit 66108864 reverted ability
      to override 'dllwrap' and 'windres' paths when cross-compiling.
      
      After this change (and a few libraries/Win32 patches) I was able
      to build cross-compiler to windows:
      
          $ ./configure --target=i686-w64-mingw32 \
              DllWrap=i686-w64-mingw32-dllwrap \
              Windres=i686-w64-mingw32-windres
      
      Later both 'dllwrap' and 'windres' should be derived from --target=
      as we do now for 'CC', 'AR', 'NM' and others.
      
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      1fd06de4
  4. May 22, 2017
  5. May 21, 2017
  6. May 20, 2017
  7. May 19, 2017
    • David Feuer's avatar
      Improve error msg for simplifier tick exhaustion · 40210c36
      David Feuer authored
      Simplifier tick exhaustion is not necessarily "impossible", and
      isn't even always a GHC bug, per se. Improve the error message.
      Furthermore, the simplifier code has access to `IO`, so we can
      throw a proper `IO` exception instead of panicking.
      
      Reviewers: austin, bgamari, angerman
      
      Reviewed By: angerman
      
      Subscribers: angerman, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3597
      40210c36
    • niteria's avatar
      Modern type signature style in Module · 4e0e120b
      niteria authored
      4e0e120b
    • Simon Peyton Jones's avatar
      Fix scoping of data cons during kind checking · 2501fb70
      Simon Peyton Jones authored
      Trac #13625 pointed out that in
      
         data X :: Y where Y :: X
      
      we need 'Y' to be in scope (as APromotionErr) when dealing with
      X's kind signature.  Previously we got a crash.
      
      This patch simplifies the code as well as making it work.
      2501fb70
    • Simon Peyton Jones's avatar
      Account for IfUnpackCo in freeNamesIfDecl · 8fe37a02
      Simon Peyton Jones authored
      We were simply failing to recognise all the free variables of an
      IfaceDecl, notably the ones in the coercion of an IfUnpackCo.
      Result: the dependency analysis got messed up, so that fingerprint
      calculation went wrong.  Trac #13695 showed it up.
      
      A test case is tricky but the fix is a solid one.
      8fe37a02
    • Simon Peyton Jones's avatar
      Refactor freeNamesIfDecl · d06cb963
      Simon Peyton Jones authored
      This just switches to using pattern matching rather than field
      selectors, which I generally prefer.  No change in behaviour.
      d06cb963
    • Simon Peyton Jones's avatar
      Comments and white space only · 875159cc
      Simon Peyton Jones authored
      875159cc
    • Aleksei Vagarenko's avatar
      Fix Haddock markup · c039624a
      Aleksei Vagarenko authored and niteria's avatar niteria committed
      c039624a
    • Simon Peyton Jones's avatar
      Ensure that insolubles are fully rewritten · 433b80de
      Simon Peyton Jones authored
      I was alerted to this by Trac #12468 and #11325.  We were treating
      insolubles (and "hole" constraints are treated as insoluble)
      inconsistently.  In some places we were carefully rewriting them
      e.g. Note [Make sure that insolubles are fully rewritten] in
      TcCanonical.  But in TcSimplify we weren't feeding them into
      the solver.
      
      As a result, "hole" constraints were not being rewritten, which
      some users found confusing, and I think rightly so.
      
      This patch also fixes a bug in TcSMonad.emitInsoluble, in which two
      different "hole" constriants could be treated (bogusly) as duplicates,
      thereby losing one.
      433b80de
  8. May 18, 2017
  9. May 17, 2017
    • Simon Peyton Jones's avatar
      Handle type-lets better · d6461f96
      Simon Peyton Jones authored
      Core allows non-recursive type-lets, thus
      
         let a = TYPE ty in ...
      
      They are substituted away very quickly, but it's convenient for
      some passes to produce them (rather than to have to substitute
      immediately).
      
      Trac #13708 tried the effect of not running the simplifer at all
      (a rather bizarre thing to do, but still).  That showed that some
      passes crashed because they always treated a let-bounder binder
      as an Id.  This patch adds some easy fixes.
      d6461f96
Loading