Skip to content
Snippets Groups Projects
  1. Sep 21, 2022
  2. Sep 20, 2022
    • matoro's avatar
      docs: clarify that LLVM codegen is not available in unregisterised mode · ee9d0f5c
      matoro authored and Marge Bot's avatar Marge Bot committed
      The current docs are misleading and suggest that it is possible to use
      LLVM codegen from an unregisterised build.  This is not the case;
      attempting to pass `-fllvm` to an unregisterised build warns:
      
      ```
      when making flags consistent: warning:
          Target platform uses unregisterised ABI, so compiling via C
      ```
      
      and uses the C codegen anyway.
      ee9d0f5c
    • Tom Ellis's avatar
      Add notes to ghc-prim Haddocks that users should not import it · 6a8c6b5e
      Tom Ellis authored and Marge Bot's avatar Marge Bot committed
      6a8c6b5e
    • John Ericson's avatar
      Relax instances for Functor combinators; put superclass on Class1 and Class2 to make non-breaking · 7beb356e
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      This change is approved by the Core Libraries commitee in
      https://github.com/haskell/core-libraries-committee/issues/10
      
      The first change makes the `Eq`, `Ord`, `Show`, and `Read` instances for
      `Sum`, `Product`, and `Compose` match those for `:+:`, `:*:`, and `:.:`.
      These have the proper flexible contexts that are exactly what the
      instance needs:
      
      For example, instead of
      ```haskell
      instance (Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a) where
        (==) = eq1
      ```
      we do
      ```haskell
      deriving instance Eq (f (g a)) => Eq (Compose f g a)
      ```
      
      But, that change alone is rather breaking, because until now `Eq (f a)`
      and `Eq1 f` (and respectively the other classes and their `*1`
      equivalents too) are *incomparable* constraints. This has always been an
      annoyance of working with the `*1` classes, and now it would rear it's
      head one last time as an pesky migration.
      
      Instead, we give the `*1` classes superclasses, like so:
      ```haskell
      (forall a. Eq a => Eq (f a)) => Eq1 f
      ```
      along with some laws that canonicity is preserved, like:
      ```haskell
      liftEq (==) = (==)
      ```
      
      and likewise for `*2` classes:
      ```haskell
      (forall a. Eq a => Eq1 (f a)) => Eq2 f
      ```
      and laws:
      ```haskell
      liftEq2 (==) = liftEq1
      ```
      
      The `*1` classes also have default methods using the `*2` classes where
      possible.
      
      What this means, as explained in the docs, is that `*1` classes really
      are generations of the regular classes, indicating that the methods can
      be split into a canonical lifting combined with a canonical inner, with
      the super class "witnessing" the laws[1] in a fashion.
      
      Circling back to the pragmatics of migrating, note that the superclass
      means evidence for the old `Sum`, `Product`, and `Compose` instances is
      (more than) sufficient, so breakage is less likely --- as long no
      instances are "missing", existing polymorphic code will continue to
      work.
      
      Breakage can occur when a datatype implements the `*1` class but not the
      corresponding regular class, but this is almost certainly an oversight.
      For example, containers made that mistake for `Tree` and `Ord`, which I
      fixed in https://github.com/haskell/containers/pull/761, but fixing the
      issue by adding `Ord1` was extremely *un*controversial.
      
      `Generically1` was also missing `Eq`, `Ord`, `Read,` and `Show`
      instances. It is unlikely this would have been caught without
      implementing this change.
      
      -----
      
      [1]: In fact, someday, when the laws are part of the language and not
      only documentation, we might be able to drop the superclass field of the
      dictionary by using the laws to recover the superclass in an
      instance-agnostic manner, e.g. with a *non*-overloaded function with
      type:
      
      ```haskell
      DictEq1 f -> DictEq a -> DictEq (f a)
      ```
      
      But I don't wish to get into optomizations now, just demonstrate the
      close relationship between the law and the superclass.
      
      Bump haddock submodule because of test output changing.
      7beb356e
    • John Ericson's avatar
      Add `Eq` and `Ord` instances for `Generically1` · c4c2cca0
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      These are needed so the subsequent commit overhauling the `*1` classes
      type-checks.
      c4c2cca0
    • Vladislav Zavialov's avatar
      Fix -Woperator-whitespace for consym (part of #19372) · 59fe128c
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Due to an oversight, the initial specification and implementation of
      -Woperator-whitespace focused on varsym exclusively and completely
      ignored consym.
      
      This meant that expressions such as "x+ y" would produce a warning,
      while "x:+ y" would not.
      
      The specification was corrected in ghc-proposals pull request #404,
      and this patch updates the implementation accordingly.
      
      Regression test included.
      59fe128c
    • sheaf's avatar
      Hadrian: merge archives even in stage 0 · 545ff490
      sheaf authored and Marge Bot's avatar Marge Bot committed
      We now always merge .a archives when ar supports -L.
      This change is necessary in order to bootstrap GHC using GHC 9.4
      on Windows, as nested archives aren't supported.
      Not doing so triggered bug #21990 when trying to use the Win32
      package, with errors such as:
      
        Not a x86_64 PE+ file.
        Unknown COFF 4 type in getHeaderInfo.
      
        ld.lld: error: undefined symbol: Win32zm2zi12zi0zi0_SystemziWin32ziConsoleziCtrlHandler_withConsoleCtrlHandler1_info
      
      We have to be careful about which ar is meant: in stage 0, the check
      should be done on the system ar (system-ar in system.config).
      545ff490
    • Jan Hrček's avatar
      Document :unadd GHCi command in user guide · 19f45a25
      Jan Hrček authored and Marge Bot's avatar Marge Bot committed
      19f45a25
  3. Sep 19, 2022
  4. Sep 18, 2022
    • Vladislav Zavialov's avatar
      Lexer: define varsym without predicates (#22201) · 75746594
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Before this patch, the varsym lexing rules were defined as follows:
      
      	<0> {
      	  @varsym / { precededByClosingToken `alexAndPred` followedByOpeningToken } { varsym_tight_infix }
      	  @varsym / { followedByOpeningToken }  { varsym_prefix }
      	  @varsym / { precededByClosingToken }  { varsym_suffix }
      	  @varsym                               { varsym_loose_infix }
      	}
      
      Unfortunately, this meant that the predicates 'precededByClosingToken' and
      'followedByOpeningToken' were recomputed several times before we could figure
      out the whitespace context.
      
      With this patch, we check for whitespace context directly in the lexer
      action:
      
      	<0> {
      	  @varsym { with_op_ws varsym }
      	}
      
      The checking for opening/closing tokens happens in 'with_op_ws' now,
      which is part of the lexer action rather than the lexer predicate.
      75746594
    • Vladislav Zavialov's avatar
      Lexer: pass updated buffer to actions (#22201) · 78037167
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      In the lexer, predicates have the following type:
      	{ ... } :: user       -- predicate state
      		-> AlexInput  -- input stream before the token
      		-> Int        -- length of the token
      		-> AlexInput  -- input stream after the token
      		-> Bool       -- True <=> accept the token
      This is documented in the Alex manual.
      
      There is access to the input stream both before and after the token.
      But when the time comes to construct the token, GHC passes only the
      initial string buffer to the lexer action. This patch fixes it:
      
      	- type Action = PsSpan -> StringBuffer -> Int ->                 P (PsLocated Token)
      	+ type Action = PsSpan -> StringBuffer -> Int -> StringBuffer -> P (PsLocated Token)
      
      Now lexer actions have access to the string buffer both before and after
      the token, just like the predicates. It's just a matter of passing an
      additional function parameter throughout the lexer.
      78037167
    • Ryan Scott's avatar
      DeriveFunctor: Check for last type variables using dataConUnivTyVars · 8a666ad2
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      Previously, derived instances of `Functor` (as well as the related classes
      `Foldable`, `Traversable`, and `Generic1`) would determine which constraints to
      infer by checking for fields that contain the last type variable. The problem
      was that this last type variable was taken from `tyConTyVars`. For GADTs, the
      type variables in each data constructor are _not_ the same type variables as
      in `tyConTyVars`, leading to #22167.
      
      This fixes the issue by instead checking for the last type variable using
      `dataConUnivTyVars`. (This is very similar in spirit to the fix for #21185,
      which also replaced an errant use of `tyConTyVars` with type variables from
      each data constructor.)
      
      Fixes #22167.
      8a666ad2
  5. Sep 17, 2022
  6. Sep 16, 2022
  7. Sep 15, 2022
  8. Sep 14, 2022
    • Douglas Wilson's avatar
      libraries: template-haskell: vendor filepath differently · 534b39ee
      Douglas Wilson authored and Marge Bot's avatar Marge Bot committed
      Vendoring with ../ in hs-source-dirs prevents upload to hackage.
      
      (cherry picked from commit 1446be75)
      534b39ee
    • Greg Steuck's avatar
      Repair c++ probing on OpenBSD · 43e574f0
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      Failure without this change:
      ```
      checking C++ standard library flavour... libc++
      checking for linkage against 'c++ c++abi'... failed
      checking for linkage against 'c++ cxxrt'... failed
      configure: error: Failed to find C++ standard library
      ```
      43e574f0
    • Matthew Pickering's avatar
      hadrian: Add extra implicit dependencies from DeriveLift · 71d8db86
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      ghc -M should know that modules which use DeriveLift (or
      TemplateHaskellQuotes) need TH.Lib.Internal but until it does, we have
      to add these extra edges manually or the modules will be compiled before
      TH.Lib.Internal is compiled which leads to a desugarer error.
      71d8db86
    • Matthew Pickering's avatar
      Remove stage1:exe:ghc-bin pre-build from CI script · c4438347
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      CI builds stage1:exe:ghc-bin before the binary-dist target which
      introduces some quite bad linearisation (see #22093) because we don't
      build stage1 compiler in parallel with anything. Then when the
      binary-dist target is started we have to build stage1:exe:ghc-pkg before
      doing anything.
      
      Fixes #22094
      c4438347
    • Matthew Pickering's avatar
      hadrian: Need builders needed by Cabal Configure in parallel · e470e91f
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Because of the use of withStaged (which needs the necessary builder)
      when configuring a package, the builds of stage1:exe:ghc-bin and
      stage1:exe:ghc-pkg where being linearised when building a specific
      target like `binary-dist-dir`.
      
      Thankfully the fix is quite local, to supply all the `withStaged`
      arguments together so the needs can be batched together and hence
      performed in parallel.
      
      Fixes #22093
      e470e91f
Loading