1. 25 Jul, 2020 6 commits
  2. 24 Jul, 2020 3 commits
  3. 23 Jul, 2020 24 commits
  4. 21 Jul, 2020 6 commits
    • Vladislav Zavialov's avatar
      Accumulate Haddock comments in P (#17544, #17561, #8944) · 19e80b9a
      Vladislav Zavialov authored
      Haddock comments are, first and foremost, comments. It's very annoying
      to incorporate them into the grammar. We can take advantage of an
      important property: adding a Haddock comment does not change the parse
      tree in any way other than wrapping some nodes in HsDocTy and the like
      (and if it does, that's a bug).
      
      This patch implements the following:
      
      * Accumulate Haddock comments with their locations in the P monad.
        This is handled in the lexer.
      
      * After parsing, do a pass over the AST to associate Haddock comments
        with AST nodes using location info.
      
      * Report the leftover comments to the user as a warning (-Winvalid-haddock).
      19e80b9a
    • Ben Gamari's avatar
      users-guide: Fix :rts-flag:`--copying-gc` documentation · 58235d46
      Ben Gamari authored
      It was missing a newline.
      58235d46
    • Matthew Pickering's avatar
      Use a newtype `Code` for the return type of typed quotations (Proposal #195) · a6257192
      Matthew Pickering authored
      There are three problems with the current API:
      
      1. It is hard to properly write instances for ``Quote m => m (TExp a)`` as the type is the composition
         of two type constructors. Doing so in your program involves making your own newtype and
         doing a lot of wrapping/unwrapping.
      
         For example, if I want to create a language which I can either run immediately or
         generate code from I could write the following with the new API. ::
      
            class Lang r where
              _int :: Int -> r Int
              _if  :: r Bool -> r a -> r a -> r a
      
            instance Lang Identity where
              _int = Identity
              _if (Identity b) (Identity t) (Identity f) = Identity (if b then t else f)
      
            instance Quote m => Lang (Code m) where
              _int = liftTyped
              _if cb ct cf = [|| if $$cb then $$ct else $$cf ||]
      
      2. When doing code generation it is common to want to store code fragments in
         a map. When doing typed code generation, these code fragments contain a
         type index so it is desirable to store them in one of the parameterised
         map data types such as ``DMap`` from ``dependent-map`` or ``MapF`` from
         ``parameterized-utils``.
      
         ::
      
            compiler :: Env -> AST a -> Code Q a
      
            data AST a where ...
            data Ident a = ...
      
            type Env = MapF Ident (Code Q)
      
            newtype Code m a = Code (m (TExp a))
      
         In this example, the ``MapF`` maps an ``Ident String`` directly to a ``Code Q String``.
         Using one of these map types currently requires creating your own newtype and constantly
         wrapping every quotation and unwrapping it when using a splice. Achievable, but
         it creates even more syntactic noise than normal metaprogramming.
      
      3. ``m (TExp a)`` is ugly to read and write, understanding ``Code m a`` is
         easier. This is a weak reason but one everyone
         can surely agree with.
      
      Updates text submodule.
      a6257192
    • Krzysztof Gogolewski's avatar
      Add release notes entry for #17816 · 05910be1
      Krzysztof Gogolewski authored
      [skip ci]
      05910be1
    • Mark Zaidelman's avatar
      863c544c
    • Sylvain Henry's avatar
      DynFlags: remove use of sdocWithDynFlags from GHC.Stg.* (#17957) · 30caeee7
      Sylvain Henry authored
      * add StgPprOpts datatype
      * remove Outputable instances for types that need `StgPprOpts` to be
        pretty-printed and explicitly call type specific ppr functions
      * add default `panicStgPprOpts` for panic messages (when it's not
        convenient to thread StgPprOpts or DynFlags down to the ppr function
        call)
      30caeee7
  5. 20 Jul, 2020 1 commit