1. 08 Nov, 2017 1 commit
    • Simon Peyton Jones's avatar
      Minimise provided dictionaries in pattern synonyms · 2c2f3cea
      Simon Peyton Jones authored
      Trac #14394 showed that it's possible to get redundant
      constraints in the inferred provided constraints of a pattern
      synonym.  This patch removes the redundancy with mkMinimalBySCs.
      
      To do this I had to generalise the type of mkMinimalBySCs slightly.
      And, to reduce confusing reversal, I made it stable: it now returns
      its result in the same order as its input.  That led to a raft of
      error message wibbles, mostly for the better.
      2c2f3cea
  2. 06 Nov, 2017 1 commit
    • Ben Gamari's avatar
      DynFlags: Introduce -show-mods-loaded flag · 8613e61d
      Ben Gamari authored
      This flag reintroduces the verbose module name output produced by GHCi's
      :load command behind a new flag, -show-mods-loaded. This was originally
      removed in D3651 but apparently some tools (e.g. haskell-mode) rely on
      this output.
      
      Addresses #14427.
      
      Test Plan: Validate
      
      Reviewers: svenpanne
      
      Reviewed By: svenpanne
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4164
      8613e61d
  3. 30 Oct, 2017 1 commit
    • Michal Terepeta's avatar
      Allow packing constructor fields · cca2d6b7
      Michal Terepeta authored
      
      
      This is another step for fixing #13825 and is based on D38 by Simon
      Marlow.
      
      The change allows storing multiple constructor fields within the same
      word. This currently applies only to `Float`s, e.g.,
      ```
      data Foo = Foo {-# UNPACK #-} !Float {-# UNPACK #-} !Float
      ```
      on 64-bit arch, will now store both fields within the same constructor
      word. For `WordX/IntX` we'll need to introduce new primop types.
      
      Main changes:
      
      - We now use sizes in bytes when we compute the offsets for
        constructor fields in `StgCmmLayout` and introduce padding if
        necessary (word-sized fields are still word-aligned)
      
      - `ByteCodeGen` had to be updated to correctly construct the data
        types. This required some new bytecode instructions to allow pushing
        things that are not full words onto the stack (and updating
        `Interpreter.c`). Note that we only use the packed stuff when
        constructing data types (i.e., for `PACK`), in all other cases the
        behavior should not change.
      
      - `RtClosureInspect` was changed to handle the new layout when
        extracting subterms. This seems to be used by things like `:print`.
        I've also added a test for this.
      
      - I deviated slightly from Simon's approach and use `PrimRep` instead
        of `ArgRep` for computing the size of fields.  This seemed more
        natural and in the future we'll probably want to introduce new
        primitive types (e.g., `Int8#`) and `PrimRep` seems like a better
        place to do that (where we already have `Int64Rep` for example).
        `ArgRep` on the other hand seems to be more focused on calling
        functions.
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar, austin, hvr, goldfire, erikd
      
      Reviewed By: bgamari
      
      Subscribers: maoe, rwbarton, thomie
      
      GHC Trac Issues: #13825
      
      Differential Revision: https://phabricator.haskell.org/D3809
      cca2d6b7
  4. 25 Oct, 2017 1 commit
  5. 19 Oct, 2017 1 commit
    • Ryan Scott's avatar
      Disable -XRebindableSyntax when running internal GHCi expressions · e023e78b
      Ryan Scott authored
      Summary:
      It's well known that `-XRebindableSyntax` doesn't play
      nicely with some of the internal expressions that GHCi runs. #13385
      was one example where this problem arose, which was fixed at the time
      by simply avoiding the use of `do`-notation in these internal GHCi
      expressions. That seemed to work, but it was a technique that proved
      not to scale, as #14342 demonstrated //another// example where
      `-XRebindableSyntax` can bite.
      
      Instead of delicately arranging the internal GHCi expressions to
      avoid anything that might be covered under `-XRebindableSyntax`,
      this patch takes the much more direct approach of disabling
      `-XRebindableSyntax` entirely when running any internal GHCi
      expression. This shouldn't hurt, since nothing internal to GHCi was
      taking advantage of the extension in the first place, and moreover,
      we can have greater confidence that some other obscure
      `-XRebindableSyntax` corner case won't pop up in the future. As an
      added bonus, this lets us once again use `do`-notation in the code
      that had to be changed when #13385 was (hackily) fixed before.
      
      Test Plan: make test TEST=T14342
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14342
      
      Differential Revision: https://phabricator.haskell.org/D4086
      e023e78b
  6. 16 Oct, 2017 1 commit
  7. 03 Oct, 2017 2 commits
    • Iavor S. Diatchki's avatar
      Implement Div, Mod, and Log for type-level nats. · fa8035e3
      Iavor S. Diatchki authored
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, dfeuer, adamgundry, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4002
      fa8035e3
    • Ryan Scott's avatar
      Track the order of user-written tyvars in DataCon · ef26182e
      Ryan Scott authored
      After typechecking a data constructor's type signature, its type
      variables are partitioned into two distinct groups: the universally
      quantified type variables and the existentially quantified type
      variables. Then, when prompted for the type of the data constructor,
      GHC gives this:
      
      ```lang=haskell
      MkT :: forall <univs> <exis>. (...)
      ```
      
      For H98-style datatypes, this is a fine thing to do. But for GADTs,
      this can sometimes produce undesired results with respect to
      `TypeApplications`. For instance, consider this datatype:
      
      ```lang=haskell
      data T a where
        MkT :: forall b a. b -> T a
      ```
      
      Here, the user clearly intended to have `b` be available for visible
      type application before `a`. That is, the user would expect
      `MkT @Int @Char` to be of type `Int -> T Char`, //not//
      `Char -> T Int`. But alas, up until now that was not how GHC
      operated—regardless of the order in which the user actually wrote
      the tyvars, GHC would give `MkT` the type:
      
      ```lang=haskell
      MkT :: forall a b. b -> T a
      ```
      
      Since `a` is universal and `b` is existential. This makes predicting
      what order to use for `TypeApplications` quite annoying, as
      demonstrated in #11721 and #13848.
      
      This patch cures the problem by tracking more carefully the order in
      which a user writes type variables in data constructor type
      signatures, either explicitly (with a `forall`) or implicitly
      (without a `forall`, in which case the order is inferred). This is
      accomplished by adding a new field `dcUserTyVars` to `DataCon`, which
      is a subset of `dcUnivTyVars` and `dcExTyVars` that is permuted to
      the order in which the user wrote them. For more details, refer to
      `Note [DataCon user type variables]` in `DataCon.hs`.
      
      An interesting consequence of this design is that more data
      constructors require wrappers. This is because the workers always
      expect the first arguments to be the universal tyvars followed by the
      existential tyvars, so when the user writes the tyvars in a different
      order, a wrapper type is needed to swizzle the tyvars around to match
      the order that the worker expects. For more details, refer to
      `Note [Data con wrappers and GADT syntax]` in `MkId.hs`.
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: ezyang, goldfire, rwbarton, thomie
      
      GHC Trac Issues: #11721, #13848
      
      Differential Revision: https://phabricator.haskell.org/D3687
      ef26182e
  8. 25 Sep, 2017 1 commit
    • Simon Peyton Jones's avatar
      Improve type-error reporting · 1b476ab5
      Simon Peyton Jones authored
      This patch does two things:
      
      * When reporting a hole, we now include its kind if the
        kind is not just '*'.  This addresses Trac #14265
      
      * When reporting things like "'a' is a rigid type varaible
        bound by ...", this patch arranges to group the type variables
        together, so we don't repeat the "bound by..." stuff endlessly
      1b476ab5
  9. 21 Sep, 2017 2 commits
    • Matthías Páll Gissurarson's avatar
      Also show types that subsume a hole as valid substitutions for that hole. · 1c920832
      Matthías Páll Gissurarson authored
      
      
      This builds on the previous "Valid substitutions include..." functionality,
      but add subsumption checking as well, so that the suggested valid substitutions
      show not only exact matches, but also identifiers that fit the hole by virtue of
      subsuming the type of the hole (i.e. being more general than the type of the
      hole).
      
      Building on the previous example, in the given program
      
      ```
      ps :: String -> IO ()
      ps = putStrLn
      
      ps2 :: a -> IO ()
      ps2 _ = putStrLn "hello, world"
      
      main :: IO ()
      main = _ "hello, world"
      ```
      
      The results would be something like
      
      ```
          • Found hole: _ :: [Char] -> IO ()
          • In the expression: _
            In the expression: _ "hello, world"
            In an equation for ‘main’: main = _ "hello, world"
          • Relevant bindings include main :: IO () (bound at t1.hs:8:1)
            Valid substitutions include
              ps :: String -> IO () (defined at t1.hs:2:1)
              ps2 :: forall a. a -> IO () (defined at t1.hs:5:1)
              putStrLn :: String -> IO ()
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘System.IO’))
              fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘GHC.Base’))
              mempty :: forall a. Monoid a => a
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘GHC.Base’))
              print :: forall a. Show a => a -> IO ()
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘System.IO’))
              (Some substitutions suppressed;
               use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
      ```
      Signed-off-by: Matthías Páll Gissurarson's avatarMatthías Páll Gissurarson <mpg@mpg.is>
      
      Modified according to suggestions from Simon PJ
      
      Accept tests that match the expectations, still a few to look better at
      
      Swithced to using tcLookup, after sit down with SPJ at ICFP. Implications are WIP.
      
      Now works with polymorphism and constraints!
      
      We still need to merge the latest master, before we can make a patch.
      
      Wrap the type of the hole, instead of implication shenanigans,
      
      As per SPJs suggestion, this is simpler and feels closer to
      what we actually want to do.
      
      Updated tests with the new implementation
      
      Remove debugging trace and update documentation
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3930
      1c920832
    • Ben Gamari's avatar
      Bump base to 4.11.0.0 · 063e0b4e
      Ben Gamari authored
      Bumps numerous submodules.
      
      Reviewers: austin, hvr
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3974
      063e0b4e
  10. 19 Sep, 2017 1 commit
  11. 14 Sep, 2017 2 commits
    • Richard Eisenberg's avatar
      Fix #13963. · 8f99cd67
      Richard Eisenberg authored
      This commit fixes several things:
      
      1. RuntimeRep arg suppression was overeager for *visibly*-quantified
      RuntimeReps, which should remain.
      
      2. The choice of whether to used a Named TyConBinder or an anonymous
      was sometimes wrong. Now, we do an extra little pass right before
      constructing the tycon to fix these.
      
      3. TyCons that normally cannot appear unsaturated can appear unsaturated
      in :kind. But this fact was not propagated into the type checker.
      It now is.
      8f99cd67
    • Richard Eisenberg's avatar
      Fix #13407 by suppressing invisibles better. · 04bb8736
      Richard Eisenberg authored
      Previously, the iface-invisible-suppresser assumed that all
      invisible things are up front. Not true!
      
      test case: ghci/scripts/T13407
      04bb8736
  12. 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
  13. 05 Sep, 2017 1 commit
    • Ryan Scott's avatar
      Fix egregious duplication of vars in RnTypes · b9ac9e05
      Ryan Scott authored
      `RnTypes` contains a fairly intricate algorithm to extract
      the kind and type variables of an HsType. This algorithm carefully
      maintains the separation between type variables and kind variables
      so that the difference between `-XPolyKinds` and `-XTypeInType` can
      be respected.
      
      But after doing all this, `rmDupsInRdrTyVars` stupidly just
      concatenated the lists of type and kind variables at the end. If a
      variable were used as both a type and a kind, the algorithm would
      produce *both*! This led to all kinds of problems, including #13988.
      
      This is mostly Richard Eisenberg's patch. The only original
      contribution I made was adapting call sites of `rnImplicitBndrs` to
      work with the new definition of `rmDupsInRdrTyVars`. That is,
      `rnImplicitBndrs` checks for variables that are illegally used in
      both type and kind positions without using `-XTypeInType`, but in
      order to check this, one cannot have filtered duplicate variables out
      before passing them to `rnImplicitBndrs`. To accommodate for this, I
      needed to concoct variations on the existing `extract-` functions in
      `RnTypes` which do not remove duplicates, and use those near
      `rnImplicitBndrs` call sites.
      
      test case: ghci/scripts/T13988
      
      Test Plan: make test TEST=T13988
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13988
      
      Differential Revision: https://phabricator.haskell.org/D3902
      b9ac9e05
  14. 02 Sep, 2017 1 commit
    • Ryan Scott's avatar
      Fix #14167 by using isGadtSyntaxTyCon in more places · 8e4229ab
      Ryan Scott authored
      Summary:
      Two places in GHC effectively attempt to //guess// whether a data type
      was declared using GADT syntax:
      
      1. When reifying a data type in Template Haskell
      2. When pretty-printing a data type (e.g., via `:info` in GHCi)
      
      But there's no need for heuristics here, since we have a 100% accurate way to
      determine whether a data type was declared using GADT syntax: the
      `isGadtSyntaxTyCon` function! By simply using that as the metric, we obtain
      far more accurate TH reification and pretty-printing results.
      
      This is technically a breaking change, since Template Haskell reification will
      now reify some data type constructors as `(Rec)GadtC` that it didn't before,
      and some data type constructors that were previously reified as `(Rec)GadtC`
      will no longer be reified as such. But it's a very understandable breaking
      change, since the previous behavior was simply incorrect.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, goldfire, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14167
      
      Differential Revision: https://phabricator.haskell.org/D3901
      8e4229ab
  15. 29 Aug, 2017 1 commit
    • Simon Peyton Jones's avatar
      Refactor bindHsQTyVars and friends · 0257dacf
      Simon Peyton Jones authored
      This work was triggered by Trac #13738, which revealed to me that
      the code RnTypes.bindHsQTyVars and bindLHsTyVarBndrs was a huge
      tangled mess -- and outright wrong on occasion as the ticket showed.
      
      The big problem was that bindLHsTyVarBndrs (which is invoked at every
      HsForAll, including nested higher rank ones) was attempting to bind
      implicit kind variables, which it has absolutely no busineess doing.
      Imlicit kind quantification is done at the outside only, in fact
      precisely where we have HsImplicitBndrs or LHsQTyVars (which also
      has implicit binders).
      
      Achieving this move was surprisingly hard, because more and more
      barnacles had accreted aroud the original mistake.  It's much
      much better now.
      
      Summary of changes.  Almost all the action is in RnTypes.
      
      * Implicit kind variables are bound only by
        - By bindHsQTyVars, which deals with LHsQTyVars
        - By rnImplicitBndrs, which deals with HsImplicitBndrs
      
      * bindLHsTyVarBndrs, and bindLHsTyVarBndr are radically simplified.
        They simply does far less, and have lots their forest of
        incomprehensible accumulating parameters.  (To be fair, some of
        the code in bindLHsTyVarBndrs just moved to bindHsQTyVars, but
        in much more perspicuous form.)
      
      * The code that checks if a variable appears in both a kind and
        a type (triggering RnTypes.mixedVarsErr) was bizarre.  E.g.
        we had this in RnTypes.extract_hs_tv_bndrs
             ; check_for_mixed_vars bndr_kvs acc_tvs
             ; check_for_mixed_vars bndr_kvs body_tvs
             ; check_for_mixed_vars body_tvs acc_kvs
             ; check_for_mixed_vars body_kvs acc_tvs
             ; check_for_mixed_vars locals body_kvs
        I cleaned all this up; now we check for mixed use at binding
        sites only.
      
      * Checks for "Variable used as a kind before being bound", like
           data T (a :: k) k = rhs
        now just show up straightforwardly as "k is not in scope".
        See Note [Kind variable ordering]
      
      * There are some knock-on simplifications in RnSource.
      0257dacf
  16. 22 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Fix #14125 by normalizing data family instances more aggressively · 6982ee99
      Ryan Scott authored
      Summary:
      Commit 3540d1e1 inadvertently broke
      the ability for newtype instances to be used as marshallable types in FFI
      declarations. The reason is a bit silly: an extra check was added for type
      synonyms with no type families on the RHS in `normalise_tc_app`, but this check
      would only skip over type families, not //data// families, since the predicate
      being used was `not . isTypeFamilyCon`.
      
      The fix is simple: just use `not . isFamilyCon` instead so that data families
      are also skipped by this check.
      
      Test Plan: make test TEST=T14125
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14125
      
      Differential Revision: https://phabricator.haskell.org/D3865
      6982ee99
  17. 17 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Remove unneeded reqlibs for mtl and parsec in the GHC testsuite · 03853475
      Ryan Scott authored
      Now that `mtl` and `parsec` are boot libraries, there's no need to
      qualify various tests in the testsuite with `reqlib('mtl')` or
      `reqlib('parsec')`.
      
      Test Plan: make test TEST="T4809 tcfail126 T4355 tc232 tc223 tc220
      tc217 tc183 T5303 DoParamM qq005 qq006 galois_raytrace T1074 mod133
      T3787 T4316 prog011 drvfail006 drvfail008"
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3855
      03853475
  18. 15 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Don't drop GHCi-defined functions with -fobject-code enabled · ddb870bf
      Ryan Scott authored
      The desugarer was using `targetRetainsAllBindings` as a litmus test for
      determining if a function was defined in interactive mode (and thus
      should be exported). However, there is a corner case where one can be in
      interactive mode and have `targetRetainsAllBindings` return `False`: if
      `-fobject-code` is enabled (since the target will no longer be
      `HscInteractive`). In such a scenario, we should fall back on a
      different test for determining if we are in a GHCi session. I chose to
      use `isInteractiveModule`, which appears to do the trick.
      
      Test Plan: make test TEST=T12091
      
      Reviewers: austin, bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #12091
      
      Differential Revision: https://phabricator.haskell.org/D3849
      ddb870bf
  19. 19 Jul, 2017 1 commit
    • Ryan Scott's avatar
      Fix #13983 by creating a TyConFlavour type, and using it · 6e3c901d
      Ryan Scott authored
      An error message was referring to a type synonym as a datatype.
      Annoyingly, learning that the TyCon over which the error message is
      operating is actually a type synonym was previously impossible, since
      that code only had access to a TcTyCon, which doesn't retain any
      information about what sort of TyCon it is.
      
      To rectify this, I created a new TyConFlavour datatype, intended to
      capture roughly what sort of TyCon we're dealing with. I then performing
      the necessary plumbing to ensure all TcTyCons have a TyConFlavour, and
      propagated this information through to the relevant error message.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie
      
      GHC Trac Issues: #13983
      
      Differential Revision: https://phabricator.haskell.org/D3747
      6e3c901d
  20. 12 Jul, 2017 1 commit
    • Ben Gamari's avatar
      [iserv] Fixing the word size for RemotePtr and toWordArray · 7ae4a28f
      Ben Gamari authored
      When we load non absolute pathed .so's this usually implies that we
      expect the system to have them in place already, and hence we should not
      need to ship them.  Without the absolute path to the library, we are
      also unable to open and send said library.  Thus we'll do library
      shipping only for libraries with absolute paths.
      
      When dealing with a host and target of different word size (say host
      hast 64bit, target has 32bit), we need to fix the RemotePtr size and the
      toWordArray function, as they are part of the iserv ResolvedBCO binary
      protocol.  This needs to be word size independent.  The choice for
      RemotePtr to 64bit was made to ensure we can store 64bit pointers when
      targeting 64bit. The choice for 32bit word arrays was made wrt.
      encoding/decoding on the potentially slower device.
      
      The efficient serialization code has been graciously provided by
      @bgamari.
      
      Reviewers: bgamari, simonmar, austin, hvr
      
      Reviewed By: bgamari
      
      Subscribers: Ericson2314, rwbarton, thomie, ryantrinkle
      
      Differential Revision: https://phabricator.haskell.org/D3443
      7ae4a28f
  21. 11 Jul, 2017 1 commit
  22. 08 Jul, 2017 1 commit
    • Tamar Christina's avatar
      Big-obj support for the Windows runtime linker · 81377e9e
      Tamar Christina authored
      Summary:
      The normal object file on Windows has a limit of `2^16`
      sections that can be in an object-file.
      
      The `big-obj` format raises this to `2^32` sections.
      
      The implementation is made difficult because we now need to support
      two header formats and two section formats that differ only by a single
      element size within each. The element that's different is in the middle
      of the structs and since the structs are used to map regions of memory
      directly, it means we need to know which struct it is when we do the
      mapping or pointer arithmetics.
      
      This is the final Object-Code format which Windows compilers can generate
      which we do not support yet in GHCI. All other major compilers on the platforms
      can produce it and all linkers consume it (bfd and lld).
      
      See http://tinyurl.com/bigobj
      
      This patch abstracts away retrieving the fields to functions which all take
      an struct which describes which object format is currently being parsed.
      These functions are always in-lined as they're small but would looks messy
      being copy-pasted everywhere.
      
      Test Plan:
      ./validate and new test `big-obj`
      
      ```
      Tamar@Rage MINGW64 /r
      $ gcc -c -Wa,-mbig-obj foo.c -o foo.o
      
      Tamar@Rage MINGW64 /r
      $ objdump -h foo.o
      
      foo.o:     file format pe-bigobj-x86-64
      
      Sections:
      Idx Name          Size      VMA               LMA               File off  Algn
        0 .text         00000010  0000000000000000  0000000000000000  00000128  2**4
                        CONTENTS, ALLOC, LOAD, READONLY, CODE
        1 .data         00000000  0000000000000000  0000000000000000  00000000  2**4
                        ALLOC, LOAD, DATA
        2 .bss          00000000  0000000000000000  0000000000000000  00000000  2**4
                        ALLOC
        3 .xdata        00000008  0000000000000000  0000000000000000  00000138  2**2
                        CONTENTS, ALLOC, LOAD, READONLY, DATA
        4 .pdata        0000000c  0000000000000000  0000000000000000  00000140  2**2
                        CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
        5 .rdata$zzz    00000030  0000000000000000  0000000000000000  0000014c  2**4
                        CONTENTS, ALLOC, LOAD, READONLY, DATA
      
      Tamar@Rage MINGW64 /r
      $ echo main | ~/ghc/inplace/bin/ghc-stage2.exe --interactive bar.hs foo.o
      GHCi, version 8.3.20170430: http://www.haskell.org/ghc/  :? for help
      [1 of 1] Compiling Main             ( bar.hs, interpreted )
      Ok, modules loaded: Main.
      *Main> 17
      *Main> Leaving GHCi.
      ```
      
      Reviewers: austin, bgamari, erikd, simonmar
      
      Subscribers: awson, rwbarton, thomie, #ghc_windows_task_force
      
      GHC Trac Issues: #13815
      
      Differential Revision: https://phabricator.haskell.org/D3523
      81377e9e
  23. 21 Jun, 2017 1 commit
  24. 02 Jun, 2017 2 commits
    • Ryan Scott's avatar
      Make GHCi work when RebindableSyntax is enabled · 2abe54e1
      Ryan Scott authored
      Previously, we were running some blocks of code at the start of every
      GHCi sessions which use do-notation, something which doesn't work well
      if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the
      code to avoid the use of do-notation so that `-XRebindableSyntax` won't
      reject it.
      
      Test Plan: make test TEST=T13385
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13385
      
      Differential Revision: https://phabricator.haskell.org/D3621
      2abe54e1
    • Tamar Christina's avatar
      Better import library support for Windows · 93489cd3
      Tamar Christina authored
      The import library support added for 7.10.3 was only a partial one.
      This support was predicated on using file extensions to determine
      whether or not a library was an import library. It also couldn't handle
      libraries with multiple dll pointers.
      
      This is a rewrite of that patch and fully integrating it into the normal
      archive parsing and loading routines. This solves a host of issues,
      among others allowing us to finally use `-lgcc_s`.
      
      This also fixes a problem with our previous implementation, where we
      just loaded the DLL and moved on. Doing this had the potential of using
      the wrong symbol at resolve time. Say a DLL already loaded (A.dll) has
      symbol a exported (dependency of another dll perhaps).
      
      We find an import library `B.lib` explicitly defining an export of `a`.
      we load `B.dll` but this gets put after `A.dll`, at resolve time we
      would use the value from `A` instead of `B` which is what we wanted.
      
      Test Plan: ./valide and make test TEST=13606
      
      Reviewers: austin, bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, RyanGlScott, thomie, #ghc_windows_task_force
      
      GHC Trac Issues: #13606, #12499, #12498
      
      Differential Revision: https://phabricator.haskell.org/D3513
      93489cd3
  25. 26 May, 2017 1 commit
    • Simon Peyton Jones's avatar
      Some tidying up of type pretty-printing · ad14efd5
      Simon Peyton Jones authored
      Triggered by the changes in #13677, I ended up doing a bit of
      refactoring in type pretty-printing.
      
      * We were using TyOpPrec and FunPrec rather inconsitently, so
        I made it consisent.
      
      * That exposed the fact that we were a bit undecided about whether
        to print
           a + b -> c + d   vs   (a+b) -> (c+d)
        and similarly
           a ~ [b] => blah  vs   (a ~ [b]) => blah
      
        I decided to make TyOpPrec and FunPrec compare equal
        (in BasicTypes), so (->) is treated as equal precedence with
        other type operators, so you get the unambiguous forms above,
        even though they have more parens.
      
        We could readily reverse this decision.
        See Note [Type operator precedence] in BasicTypes
      
      * I fixed a bug in pretty-printing of HsType where some
        parens were omitted by mistake.
      ad14efd5
  26. 20 May, 2017 1 commit
  27. 25 Apr, 2017 2 commits
    • Ryan Scott's avatar
      Only pretty-print binders in closed type families with -fprint-explicit-foralls · da792e47
      Ryan Scott authored
      Previously, we were unconditionally pretty-printing all type variable
      binders when pretty-printing closed type families (e.g., in the output
      of `:info` in GHCi). This threw me for a loop, so let's guard this behind
      the `-fprint-explicit-foralls` flag.
      
      Test Plan: make test TEST=T13420
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13420
      
      Differential Revision: https://phabricator.haskell.org/D3497
      da792e47
    • Simon Marlow's avatar
      Don't setProgramDynFlags on every :load · 914842e5
      Simon Marlow authored
      Summary:
      setProgramDynFlags invalidates the whole module graph, forcing
      everything to be re-summarised (including preprocessing) on every
      :reload.
      
      Looks like this was a bad regression in 8.0, but we didn't notice
      because there was no test for it.  Now there is!
      
      Test Plan:
      * validate
      * new unit test
      
      Reviewers: bgamari, triple, austin, niteria, erikd, jme
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3398
      914842e5
  28. 23 Apr, 2017 1 commit
  29. 02 Apr, 2017 2 commits
  30. 29 Mar, 2017 2 commits
    • Matthías Páll Gissurarson's avatar
      Show valid substitutions for typed holes · 26c95f46
      Matthías Páll Gissurarson authored
      The idea is to implement a mechanism similar to PureScript, where they
      suggest which identifiers in scope would fit the given hole. In
      PureScript, they use subsumption (which is what we would like here as
      well). For subsumption, we would have to check each type in scope
      whether the hole is a subtype of the given type, but that would require
      `tcSubType` and constraint satisfiability checking. Currently,
      `TcSimplify` uses a lot of functions from `TcErrors`, so that would
      require more of a rewrite, I will hold on with that for now, and submit
      the more simpler type equality version.
      
      As an example, consider
      
      ```
      ps :: String -> IO ()
      ps = putStrLn
      
      ps2 :: a -> IO ()
      ps2 _ = putStrLn "hello, world"
      
      main :: IO ()
      main = _ "hello, world"
      ```
      
      The results would be something like
      
      ```
          • Found hole: _ :: [Char] -> IO ()
          • In the expression: _
            In a stmt of a 'do' block: _ "hello, world"
            In the expression:
              do _ "hello, world"
          • Relevant bindings include
              main :: IO () (bound at test.hs:13:1)
              ps :: String -> IO () (bound at test.hs:7:1)
              ps2 :: forall a. a  -> IO () (bound at test.hs:10:1)
            Valid substitutions include
              putStrLn :: String
                          -> IO () (imported from ‘Prelude’ at
      test.hs:1:1-14
                                    (and originally defined in
      ‘System.IO’))
              putStr :: String
                        -> IO () (imported from ‘Prelude’ at
      test.hs:1:1-14
                                  (and originally defined in ‘System.IO’))
      ```
      
      We'd like here for ps2 to be suggested as well, but for that we require
      subsumption.
      
      Reviewers: austin, bgamari, dfeuer, mpickering
      
      Reviewed By: dfeuer, mpickering
      
      Subscribers: mpickering, Wizek, dfeuer, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3361
      26c95f46
    • ruperthorlick's avatar
      Fixed error messages for RecursiveDo (#8501) · 5856c564
      ruperthorlick authored
      
      
      Changes in a few different places to catch several different
      types of error related to RecursiveDo
      Signed-off-by: ruperthorlick's avatarRupert Horlick <ruperthorlick@gmail.com>
      
      Test Plan: Three test cases, with further tests in comments
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3271
      5856c564
  31. 27 Mar, 2017 2 commits
    • Simon Peyton Jones's avatar
      Fix 'unsolved constraints' in GHCi · feca929b
      Simon Peyton Jones authored
      In initTc, if the computation fails with an exception, we
      should not complain about unsolved constraints.
      
      Fixes Trac #13466.
      feca929b
    • Simon Peyton Jones's avatar
      Fix error-message suppress on given equalities · e0ad55f8
      Simon Peyton Jones authored
      I'd got the logic slightly wrong when reporting type errors
      for insoluble 'given' equalities.  We suppress insoluble givens
      under some circumstances (see Note [Given errors]), but we then
      suppressed subsequent 'wanted' errors because the (suppressed)
      'given' error "won".  Result: no errors at all :-(.
      
      This patch fixes it and
       - Renames TcType.isTyVarUnderDatatype to the more
         perspicuous TcType.isInsolubleOccursCheck
      
      In doing this I realise that I don't understand why we need
      to keep the insolubles partitioned out separately at all...
      but that is for another day.
      e0ad55f8
  32. 17 Mar, 2017 1 commit