Skip to content
Snippets Groups Projects
  1. Aug 16, 2023
  2. Jul 26, 2023
    • Bartłomiej Cieślar's avatar
      This MR is an implementation of the proposal #516. · 503fd647
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      It adds a warning -Wincomplete-record-selectors for usages of a record
      field access function (either a record selector or getField @"rec"),
      while trying to silence the warning whenever it can be sure that a constructor
      without the record field would not be invoked (which would otherwise cause
      the program to fail). For example:
      
          data T = T1 | T2 {x :: Bool}
      
          f a = x a -- this would throw an error
      
          g T1 = True
          g a = x a -- this would not throw an error
      
          h :: HasField "x" r Bool => r -> Bool
          h = getField @"x"
      
          j :: T -> Bool
          j = h -- this would throw an error because of the `HasField`
                -- constraint being solved
      
      See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning.
      See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details
      503fd647
  3. Jul 22, 2023
  4. Jun 21, 2023
  5. Jun 13, 2023
    • Oleg Grenrus's avatar
      Change WarningWithFlag to plural WarningWithFlags · a1f350e2
      Oleg Grenrus authored and Marge Bot's avatar Marge Bot committed
      Resolves #22825
      
      Now each diagnostic can name multiple different warning flags for its reason.
      
      There is currently one use case: missing signatures.
      Currently we need to check which warning flags are enabled when
      generating the diagnostic, which is against the declarative nature of
      the diagnostic framework.
      
      This patch allows a warning diagnostic to have multiple warning flags,
      which makes setup more declarative.
      
      The WarningWithFlag pattern synonym is added for backwards compatibility
      
      The 'msgEnvReason' field is added to MsgEnvelope to store the
      `ResolvedDiagnosticReason`, which accounts for the enabled flags, and
      then that is used for pretty printing the diagnostic.
      a1f350e2
  6. May 26, 2023
    • Matthew Pickering's avatar
      error messages: Don't display ghci specific hints for missing packages · 34b44f7d
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Tickets like #22884 suggest that it is confusing that GHC used on the
      command line can suggest options which only work in GHCi.
      
      This ticket uses the error message infrastructure to override certain
      error messages which displayed GHCi specific information so that this
      information is only showed when using GHCi.
      
      The main annoyance is that we mostly want to display errors in the same
      way as before, but with some additional information. This means that the
      error rendering code has to be exported from the Iface/Errors/Ppr.hs
      module.
      
      I am unsure about whether the approach taken here is the best or most
      maintainable solution.
      
      Fixes #22884
      34b44f7d
  7. May 05, 2023
    • Aaron Allen's avatar
      Rework plugin initialisation points · 18a7d03d
      Aaron Allen authored and Marge Bot's avatar Marge Bot committed
      
      In general this patch pushes plugin initialisation points to earlier in
      the pipeline. As plugins can modify the `HscEnv`, it's imperative that
      the plugins are initialised as soon as possible and used thereafter.
      
      For example, there are some new tests which modify hsc_logger and other
      hooks which failed to fire before (and now do)
      
      One consequence of this change is that the error for specifying the
      usage of a HPT plugin from the command line has changed, because it's
      now attempted to be loaded at initialisation rather than causing a
      cyclic module import.
      
      Closes #21279
      
      Co-authored-by: default avatarMatthew Pickering <matthewtpickering@gmail.com>
      18a7d03d
  8. Apr 18, 2023
    • Matthew Pickering's avatar
      Convert interface file loading errors into proper diagnostics · 5e1d33d7
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This patch converts all the errors to do with loading interface files
      into proper structured diagnostics.
      
      * DriverMessage: Sometimes in the driver we attempt to load an interface
        file so we embed the IfaceMessage into the DriverMessage.
      * TcRnMessage: Most the time we are loading interface files during
        typechecking, so we embed the IfaceMessage
      
      This patch also removes the TcRnInterfaceLookupError constructor which
      is superceded by the IfaceMessage, which is now structured compared to
      just storing an SDoc before.
      5e1d33d7
  9. Mar 29, 2023
    • sheaf's avatar
      Handle records in the renamer · 3f374399
      sheaf authored
      This patch moves the field-based logic for disambiguating record updates
      to the renamer. The type-directed logic, scheduled for removal, remains
      in the typechecker.
      
      To do this properly (and fix the myriad of bugs surrounding the treatment
      of duplicate record fields), we took the following main steps:
      
        1. Create GREInfo, a renamer-level equivalent to TyThing which stores
           information pertinent to the renamer.
           This allows us to uniformly treat imported and local Names in the
           renamer, as described in Note [GREInfo].
      
        2. Remove GreName. Instead of a GlobalRdrElt storing GreNames, which
           distinguished between normal names and field names, we now store
           simple Names in GlobalRdrElt, along with the new GREInfo information
           which allows us to recover the FieldLabel for record fields.
      
        3. Add namespacing for record fields, within the OccNames themselves.
           This allows us to remove the mangling of duplicate field selectors.
      
           This change ensures we don't print mangled names to the user in
           error messages, and allows us to handle duplicate record fields
           in Template Haskell.
      
        4. Move record disambiguation to the renamer, and operate on the
           level of data constructors instead, to handle #21443.
      
           The error message text for ambiguous record updates has also been
           changed to reflect that type-directed disambiguation is on the way
           out.
      
      (3) means that OccEnv is now a bit more complex: we first key on the
      textual name, which gives an inner map keyed on NameSpace:
      
        OccEnv a ~ FastStringEnv (UniqFM NameSpace a)
      
      Note that this change, along with (2), both increase the memory residency
      of GlobalRdrEnv = OccEnv [GlobalRdrElt], which causes a few tests to
      regress somewhat in compile-time allocation.
      
      Even though (3) simplified a lot of code (in particular the treatment of
      field selectors within Template Haskell and in error messages), it came
      with one important wrinkle: in the situation of
      
        -- M.hs-boot
        module M where { data A; foo :: A -> Int }
        -- M.hs
        module M where { data A = MkA { foo :: Int } }
      
      we have that M.hs-boot exports a variable foo, which is supposed to match
      with the record field foo that M exports. To solve this issue, we add a
      new impedance-matching binding to M
      
        foo{var} = foo{fld}
      
      This mimics the logic that existed already for impedance-binding DFunIds,
      but getting it right was a bit tricky.
      See Note [Record field impedance matching] in GHC.Tc.Module.
      
      We also needed to be careful to avoid introducing space leaks in GHCi.
      So we dehydrate the GlobalRdrEnv before storing it anywhere, e.g. in
      ModIface. This means stubbing out all the GREInfo fields, with the
      function forceGlobalRdrEnv.
      When we read it back in, we rehydrate with rehydrateGlobalRdrEnv.
      This robustly avoids any space leaks caused by retaining old type
      environments.
      
      Fixes #13352 #14848 #17381 #17551 #19664 #21443 #21444 #21720 #21898 #21946 #21959 #22125 #22160 #23010 #23062 #23063
      
      Updates haddock submodule
      
      -------------------------
      Metric Increase:
          MultiComponentModules
          MultiLayerModules
          MultiLayerModulesDefsGhci
          MultiLayerModulesNoCode
          T13701
          T14697
          hard_hole_fits
      -------------------------
      3f374399
  10. Feb 20, 2023
    • Rodrigo Mesquita's avatar
      fix: Explicitly flush stdout on plugin · 0196cc2b
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Because of #20791, the plugins tests often fail.  This is a temporary
      fix to stop the tests from failing due to unflushed outputs on windows
      and the explicit flush should be removed when #20791 is fixed.
      0196cc2b
  11. Dec 24, 2022
    • Matthew Pickering's avatar
      Store RdrName rather than OccName in Holes · 6d62f6bf
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      In #20472 it was pointed out that you couldn't defer out of scope but
      the implementation collapsed a RdrName into an OccName to stuff it into
      a Hole. This leads to the error message for a deferred qualified name
      dropping the qualification which affects the quality of the error
      message.
      
      This commit adds a bit more structure to a hole, so a hole can replace a
      RdrName without losing information about what that RdrName was. This is
      important when printing error messages.
      
      I also added a test which checks the Template Haskell deferral of out of
      scope qualified names works properly.
      
      Fixes #22130
      6d62f6bf
  12. Dec 01, 2022
  13. Nov 25, 2022
    • Vladislav Zavialov's avatar
      Print unticked promoted data constructors (#20531) · 13d627bb
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      
      Before this patch, GHC unconditionally printed ticks before promoted
      data constructors:
      
      	ghci> type T = True  -- unticked (user-written)
      	ghci> :kind! T
      	T :: Bool
      	= 'True              -- ticked (compiler output)
      
      After this patch, GHC prints ticks only when necessary:
      
      	ghci> type F = False    -- unticked (user-written)
      	ghci> :kind! F
      	F :: Bool
      	= False                 -- unticked (compiler output)
      
      	ghci> data False        -- introduce ambiguity
      	ghci> :kind! F
      	F :: Bool
      	= 'False                -- ticked by necessity (compiler output)
      
      The old behavior can be enabled by -fprint-redundant-promotion-ticks.
      
      Summary of changes:
      * Rename PrintUnqualified to NamePprCtx
      * Add QueryPromotionTick to it
      * Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick)
      * Introduce -fprint-redundant-promotion-ticks
      
      Co-authored-by: default avatarArtyom Kuznetsov <hi@wzrd.ht>
      13d627bb
  14. Sep 13, 2022
    • sheaf's avatar
      Diagnostic codes: acccept test changes · 362cca13
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The testsuite output now contains diagnostic codes, so many tests need
      to be updated at once.
      We decided it was best to keep the diagnostic codes in the testsuite
      output, so that contributors don't inadvertently make changes to the
      diagnostic codes.
      362cca13
  15. Aug 10, 2022
    • Sylvain Henry's avatar
      Add support for external static plugins (#20964) · f95bbdca
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      
      This patch adds a new command-line flag:
      
        -fplugin-library=<file-path>;<unit-id>;<module>;<args>
      
      used like this:
      
        -fplugin-library=path/to/plugin.so;package-123;Plugin.Module;["Argument","List"]
      
      It allows a plugin to be loaded directly from a shared library. With
      this approach, GHC doesn't compile anything for the plugin and doesn't
      load any .hi file for the plugin and its dependencies. As such GHC
      doesn't need to support two environments (one for plugins, one for
      target code), which was the more ambitious approach tracked in #14335.
      
      Fix #20964
      
      Co-authored-by: default avatarJosh Meredith <joshmeredith2008@gmail.com>
      f95bbdca
  16. Jul 03, 2022
  17. Apr 07, 2022
  18. Apr 06, 2022
  19. Apr 01, 2022
  20. Mar 30, 2022
    • Jakob Brünker's avatar
      Give parsing plugins access to errors · f07c7766
      Jakob Brünker authored and Marge Bot's avatar Marge Bot committed
      Previously, when the parser produced non-fatal errors (i.e. it produced
      errors but the 'PState' is 'POk'), compilation would be aborted before
      the 'parsedResultAction' of any plugin was invoked. This commit changes
      that, so that such that 'parsedResultAction' gets collections of
      warnings and errors as argument, and must return them after potentially
      modifying them.
      
      Closes #20803
      f07c7766
  21. Mar 14, 2022
    • Rodrigo Mesquita's avatar
      TTG Pull AbsBinds and ABExport out of the main AST · 135888dd
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      AbsBinds and ABExport both depended on the typechecker, and were thus
      removed from the main AST Expr.
      
      CollectPass now has a new function `collectXXHsBindsLR` used for the new
      HsBinds extension point
      
      Bumped haddock submodule to work with AST changes.
      
      The removed Notes from Language.Haskell.Syntax.Binds were duplicated
      (and not referenced) and the copies in GHC.Hs.Binds are kept (and
      referenced there). (See #19252)
      135888dd
  22. Feb 03, 2022
  23. Dec 28, 2021
    • Matthew Pickering's avatar
      Multiple Home Units · fd42ab5f
      Matthew Pickering authored
      
      Multiple home units allows you to load different packages which may depend on
      each other into one GHC session. This will allow both GHCi and HLS to support
      multi component projects more naturally.
      
      Public Interface
      ~~~~~~~~~~~~~~~~
      
      In order to specify multiple units, the -unit @⟨filename⟩ flag
      is given multiple times with a response file containing the arguments for each unit.
      The response file contains a newline separated list of arguments.
      
      ```
      ghc -unit @unitLibCore -unit @unitLib
      ```
      
      where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode.
      
      ```
      -this-unit-id lib-core-0.1.0.0
      -i
      -isrc
      LibCore.Utils
      LibCore.Types
      ```
      
      The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core.
      
      ```
      -this-unit-id lib-0.1.0.0
      -package-id lib-core-0.1.0.0
      -i
      -isrc
      Lib.Parse
      Lib.Render
      ```
      
      Then when the compiler starts in --make mode it will compile both units lib and lib-core.
      
      There is also very basic support for multiple home units in GHCi, at the
      moment you can start a GHCi session with multiple units but only the
      :reload is supported. Most commands in GHCi assume a single home unit,
      and so it is additional work to work out how to modify the interface to
      support multiple loaded home units.
      
      Options used when working with Multiple Home Units
      
      There are a few extra flags which have been introduced specifically for
      working with multiple home units. The flags allow a home unit to pretend
      it’s more like an installed package, for example, specifying the package
      name, module visibility and reexported modules.
      
      -working-dir ⟨dir⟩
      
          It is common to assume that a package is compiled in the directory
          where its cabal file resides. Thus, all paths used in the compiler
          are assumed to be relative to this directory. When there are
          multiple home units the compiler is often not operating in the
          standard directory and instead where the cabal.project file is
          located. In this case the -working-dir option can be passed which
          specifies the path from the current directory to the directory the
          unit assumes to be it’s root, normally the directory which contains
          the cabal file.
      
          When the flag is passed, any relative paths used by the compiler are
          offset by the working directory. Notably this includes -i and
          -I⟨dir⟩ flags.
      
      -this-package-name ⟨name⟩
      
          This flag papers over the awkward interaction of the PackageImports
          and multiple home units. When using PackageImports you can specify
          the name of the package in an import to disambiguate between modules
          which appear in multiple packages with the same name.
      
          This flag allows a home unit to be given a package name so that you
          can also disambiguate between multiple home units which provide
          modules with the same name.
      
      -hidden-module ⟨module name⟩
      
          This flag can be supplied multiple times in order to specify which
          modules in a home unit should not be visible outside of the unit it
          belongs to.
      
          The main use of this flag is to be able to recreate the difference
          between an exposed and hidden module for installed packages.
      
      -reexported-module ⟨module name⟩
      
          This flag can be supplied multiple times in order to specify which
          modules are not defined in a unit but should be reexported. The
          effect is that other units will see this module as if it was defined
          in this unit.
      
          The use of this flag is to be able to replicate the reexported
          modules feature of packages with multiple home units.
      
      Offsetting Paths in Template Haskell splices
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      When using Template Haskell to embed files into your program,
      traditionally the paths have been interpreted relative to the directory
      where the .cabal file resides. This causes problems for multiple home
      units as we are compiling many different libraries at once which have
      .cabal files in different directories.
      
      For this purpose we have introduced a way to query the value of the
      -working-dir flag to the Template Haskell API. By using this function we
      can implement a makeRelativeToProject function which offsets a path
      which is relative to the original project root by the value of
      -working-dir.
      
      ```
      import Language.Haskell.TH.Syntax ( makeRelativeToProject )
      
      foo = $(makeRelativeToProject "./relative/path" >>= embedFile)
      ```
      
      > If you write a relative path in a Template Haskell splice you should use the makeRelativeToProject function so that your library works correctly with multiple home units.
      
      A similar function already exists in the file-embed library. The
      function in template-haskell implements this function in a more robust
      manner by honouring the -working-dir flag rather than searching the file
      system.
      
      Closure Property for Home Units
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      For tools or libraries using the API there is one very important closure
      property which must be adhered to:
      
      > Any dependency which is not a home unit must not (transitively) depend
        on a home unit.
      
      For example, if you have three packages p, q and r, then if p depends on
      q which depends on r then it is illegal to load both p and r as home
      units but not q, because q is a dependency of the home unit p which
      depends on another home unit r.
      
      If you are using GHC by the command line then this property is checked,
      but if you are using the API then you need to check this property
      yourself. If you get it wrong you will probably get some very confusing
      errors about overlapping instances.
      
      Limitations of Multiple Home Units
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      There are a few limitations of the initial implementation which will be smoothed out on user demand.
      
          * Package thinning/renaming syntax is not supported
          * More complicated reexports/renaming are not yet supported.
          * It’s more common to run into existing linker bugs when loading a
            large number of packages in a session (for example #20674, #20689)
          * Backpack is not yet supported when using multiple home units.
          * Dependency chasing can be quite slow with a large number of
            modules and packages.
          * Loading wired-in packages as home units is currently not supported
            (this only really affects GHC developers attempting to load
            template-haskell).
          * Barely any normal GHCi features are supported, it would be good to
            support enough for ghcid to work correctly.
      
      Despite these limitations, the implementation works already for nearly
      all packages. It has been testing on large dependency closures,
      including the whole of head.hackage which is a total of 4784 modules
      from 452 packages.
      
      Internal Changes
      ~~~~~~~~~~~~~~~~
      
      * The biggest change is that the HomePackageTable is replaced with the
        HomeUnitGraph. The HomeUnitGraph is a map from UnitId to HomeUnitEnv,
        which contains information specific to each home unit.
      * The HomeUnitEnv contains:
          - A unit state, each home unit can have different package db flags
          - A set of dynflags, each home unit can have different flags
          - A HomePackageTable
      * LinkNode: A new node type is added to the ModuleGraph, this is used to
        place the linking step into the build plan so linking can proceed in
        parralel with other packages being built.
      * New invariant: Dependencies of a ModuleGraphNode can be completely
        determined by looking at the value of the node. In order to achieve
        this, downsweep now performs a more complete job of downsweeping and
        then the dependenices are recorded forever in the node rather than
        being computed again from the ModSummary.
      * Some transitive module calculations are rewritten to use the
        ModuleGraph which is more efficient.
      * There is always an active home unit, which simplifies modifying a lot
        of the existing API code which is unit agnostic (for example, in the
        driver).
      
      The road may be bumpy for a little while after this change but the
      basics are well-tested.
      
      One small metric increase, which we accept and also submodule update to
      haddock which removes ExtendedModSummary.
      
      Closes #10827
      
      -------------------------
      Metric Increase:
          MultiLayerModules
      -------------------------
      
      Co-authored-by: default avatarFendor <power.walross@gmail.com>
      fd42ab5f
  24. Dec 21, 2021
    • Sylvain Henry's avatar
      Give plugins a better interface (#17957) · 9728d6c2
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Plugins were directly fetched from HscEnv (hsc_static_plugins and
      hsc_plugins). The tight coupling of plugins and of HscEnv is undesirable
      and it's better to store them in a new Plugins datatype and to use it in
      the plugins' API (e.g. withPlugins, mapPlugins...).
      
      In the process, the interactive context (used by GHCi) got proper
      support for different static plugins than those used for loaded modules.
      
      Bump haddock submodule
      9728d6c2
  25. Dec 15, 2021
  26. Dec 12, 2021
    • Oleg Grenrus's avatar
      Use HasCallStack and error in GHC.List and .NonEmpty · 31bf380f
      Oleg Grenrus authored and Marge Bot's avatar Marge Bot committed
      In addition to providing stack traces, the scary HasCallStack will
      hopefully make people think whether they want to use these functions,
      i.e. act as a documentation hint that something weird might happen.
      
      A single metric increased, which doesn't visibly
      use any method with `HasCallStack`.
      
      -------------------------
      Metric Decrease:
          T9630
      Metric Decrease:
          T19695
          T9630
      -------------------------
      31bf380f
  27. Nov 26, 2021
  28. Nov 20, 2021
    • Sylvain Henry's avatar
      More support for optional home-unit · bdeea37e
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      This is a preliminary refactoring for #14335 (supporting plugins in
      cross-compilers). In many places the home-unit must be optional because
      there won't be one available in the plugin environment (we won't be
      compiling anything in this environment). Hence we replace "HomeUnit"
      with "Maybe HomeUnit" in a few places and we avoid the use of
      "hsc_home_unit" (which is partial) in some few others.
      bdeea37e
  29. Nov 17, 2021
    • Ben Gamari's avatar
      Increase type sharing · 083a7583
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Fixes #20541 by making mkTyConApp do more sharing of types.
      In particular, replace
      
      * BoxedRep Lifted    ==>  LiftedRep
      * BoxedRep Unlifted  ==>  UnliftedRep
      * TupleRep '[]       ==>  ZeroBitRep
      * TYPE ZeroBitRep    ==>  ZeroBitType
      
      In each case, the thing on the right is a type synonym
      for the thing on the left, declared in ghc-prim:GHC.Types.
      See Note [Using synonyms to compress types] in GHC.Core.Type.
      
      The synonyms for ZeroBitRep and ZeroBitType are new, but absolutely
      in the same spirit as the other ones.   (These synonyms are mainly
      for internal use, though the programmer can use them too.)
      
      I also renamed GHC.Core.Ty.Rep.isVoidTy to isZeroBitTy, to be
      compatible with the "zero-bit" nomenclature above.  See discussion
      on !6806.
      
      There is a tricky wrinkle: see GHC.Core.Types
        Note [Care using synonyms to compress types]
      
      Compiler allocation decreases by up to 0.8%.
      083a7583
  30. Oct 22, 2021
    • Sylvain Henry's avatar
      Refactor package imports · 806e49ae
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Use an (Raw)PkgQual datatype instead of `Maybe FastString` to represent
      package imports. Factorize the code that renames RawPkgQual into PkgQual
      in function `rnPkgQual`. Renaming consists in checking if the FastString
      is the magic "this" keyword, the home-unit unit-id or something else.
      
      Bump haddock submodule
      806e49ae
  31. Oct 20, 2021
  32. Oct 17, 2021
    • sheaf's avatar
      Introduce Concrete# for representation polymorphism checks · 81740ce8
      sheaf authored and Marge Bot's avatar Marge Bot committed
      PHASE 1: we never rewrite Concrete# evidence.
      
      This patch migrates all the representation polymorphism checks to
      the typechecker, using a new constraint form
      
        Concrete# :: forall k. k -> TupleRep '[]
      
      Whenever a type `ty` must be representation-polymorphic
      (e.g. it is the type of an argument to a function), we emit a new
      `Concrete# ty` Wanted constraint. If this constraint goes
      unsolved, we report a representation-polymorphism error to the user.
      The 'FRROrigin' datatype keeps track of the context of the
      representation-polymorphism check, for more informative error messages.
      
      This paves the way for further improvements, such as
      allowing type families in RuntimeReps and improving the soundness
      of typed Template Haskell. This is left as future work (PHASE 2).
      
      fixes #17907 #20277 #20330 #20423 #20426
      
      updates haddock submodule
      
      -------------------------
      Metric Decrease:
          T5642
      -------------------------
      81740ce8
  33. Oct 08, 2021
    • abarbu's avatar
      Add defaulting plugins. · a76409c7
      abarbu authored
      Like the built-in type defaulting rules these plugins can propose candidates
      to resolve ambiguous type variables.
      
      Machine learning and other large APIs like those for game engines introduce
      new numeric types and other complex typed APIs. The built-in defaulting
      mechanism isn't powerful enough to resolve ambiguous types in these cases forcing
      users to specify minutia that they might not even know how to do. There is
      an example defaulting plugin linked in the documentation. Applications include
      defaulting the device a computation executes on, if a gradient should be
      computed for a tensor, or the size of a tensor.
      
      See https://github.com/ghc-proposals/ghc-proposals/pull/396 for details.
      a76409c7
    • Sylvain Henry's avatar
      Don't link plugins' units with target code (#20218) · 3d31f11e
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Before this patch, plugin units were linked with the target code even
      when the unit was passed via `-plugin-package`. This is an issue to
      support plugins in cross-compilers (plugins are definitely not ABI
      compatible with target code).
      
      We now clearly separate unit dependencies for plugins and unit
      dependencies for target code and only link the latter ones.
      
      We've also added a test to ensure that plugin units passed via
      `-package` are linked with target code so that `thNameToGhcName` can
      still be used in plugins that need it (see T20218b).
      3d31f11e
Loading