Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

10 changed files:

Changes:

  • compiler/GHC/Builtin/Names/TH.hs
    ... ... @@ -185,7 +185,7 @@ thSyn, thMonad, thLib, qqLib, liftLib :: Module
    185 185
     thSyn = mkTHModule (fsLit "GHC.Internal.TH.Syntax")
    
    186 186
     thMonad = mkTHModule (fsLit "GHC.Internal.TH.Monad")
    
    187 187
     thLib = mkTHModule (fsLit "GHC.Internal.TH.Lib")
    
    188
    -qqLib = mkTHModule (fsLit "GHC.Internal.TH.Quote")
    
    188
    +qqLib = mkTHModule (fsLit "GHC.Internal.TH.Monad")
    
    189 189
     liftLib = mkTHModule (fsLit "GHC.Internal.TH.Lift")
    
    190 190
     
    
    191 191
     
    

  • libraries/ghc-boot-th/GHC/Boot/TH/Quote.hs
    1 1
     {-# OPTIONS_HADDOCK not-home #-}
    
    2 2
     module GHC.Boot.TH.Quote
    
    3
    -  (module GHC.Internal.TH.Quote) where
    
    3
    +  (QuasiQuoter(..)) where
    
    4 4
     
    
    5
    -import GHC.Internal.TH.Quote
    5
    +import GHC.Internal.TH.Monad (QuasiQuoter(..))

  • libraries/ghc-internal/ghc-internal.cabal.in
    ... ... @@ -306,7 +306,6 @@ Library
    306 306
             GHC.Internal.TH.Syntax
    
    307 307
             GHC.Internal.TH.Lib
    
    308 308
             GHC.Internal.TH.Lift
    
    309
    -        GHC.Internal.TH.Quote
    
    310 309
             GHC.Internal.TH.Monad
    
    311 310
             GHC.Internal.TopHandler
    
    312 311
             GHC.Internal.TypeError
    

  • libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
    ... ... @@ -20,6 +20,7 @@
    20 20
     -- Import "Language.Haskell.TH" or "Language.Haskell.TH.Syntax" instead!
    
    21 21
     module GHC.Internal.TH.Monad
    
    22 22
         ( module GHC.Internal.TH.Monad
    
    23
    +    , QuasiQuoter(..)
    
    23 24
         ) where
    
    24 25
     
    
    25 26
     #ifdef BOOTSTRAP_TH
    
    ... ... @@ -313,6 +314,33 @@ class Monad m => Quote m where
    313 314
     instance Quote Q where
    
    314 315
       newName s = Q (qNewName s)
    
    315 316
     
    
    317
    +-----------------------------------------------------
    
    318
    +--
    
    319
    +--              The QuasiQuoter type
    
    320
    +--
    
    321
    +-----------------------------------------------------
    
    322
    +
    
    323
    +-- | The 'QuasiQuoter' type, a value @q@ of this type can be used
    
    324
    +-- in the syntax @[q| ... string to parse ...|]@.  In fact, for
    
    325
    +-- convenience, a 'QuasiQuoter' actually defines multiple quasiquoters
    
    326
    +-- to be used in different splice contexts. In the usual case of a
    
    327
    +-- @QuasiQuoter@ that is only intended to be used in certain splice
    
    328
    +-- contexts, the unused fields should just 'fail'. This is most easily
    
    329
    +-- accomplished using 'namedefaultQuasiQuoter' or 'defaultQuasiQuoter'.
    
    330
    +--
    
    331
    +-- This is exposed both from the @template-haskell-quasiquoter@ and @template-haskell@ packages.
    
    332
    +-- Consider importing it from the more stable @template-haskell-quasiquoter@ if you don't need the full breadth of the @template-haskell@ interface.
    
    333
    +data QuasiQuoter = QuasiQuoter {
    
    334
    +    -- | Quasi-quoter for expressions, invoked by quotes like @lhs = $[q|...]@
    
    335
    +    quoteExp  :: String -> Q Exp,
    
    336
    +    -- | Quasi-quoter for patterns, invoked by quotes like @f $[q|...] = rhs@
    
    337
    +    quotePat  :: String -> Q Pat,
    
    338
    +    -- | Quasi-quoter for types, invoked by quotes like @f :: $[q|...]@
    
    339
    +    quoteType :: String -> Q Type,
    
    340
    +    -- | Quasi-quoter for declarations, invoked by top-level quotes
    
    341
    +    quoteDec  :: String -> Q [Dec]
    
    342
    +    }
    
    343
    +
    
    316 344
     -----------------------------------------------------
    
    317 345
     --
    
    318 346
     --              The TExp type
    

  • libraries/ghc-internal/src/GHC/Internal/TH/Quote.hs deleted
    1
    -{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables, Trustworthy #-}
    
    2
    -{- |
    
    3
    -Module : GHC.Internal.TH.Quote
    
    4
    -Description : Quasi-quoting support for Template Haskell
    
    5
    -
    
    6
    -Template Haskell supports quasiquoting, which permits users to construct
    
    7
    -program fragments by directly writing concrete syntax.  A quasiquoter is
    
    8
    -essentially a function with takes a string to a Template Haskell AST.
    
    9
    -This module defines the 'QuasiQuoter' datatype, which specifies a
    
    10
    -quasiquoter @q@ which can be invoked using the syntax
    
    11
    -@[q| ... string to parse ... |]@ when the @QuasiQuotes@ language
    
    12
    -extension is enabled, and some utility functions for manipulating
    
    13
    -quasiquoters.  Nota bene: this package does not define any parsers,
    
    14
    -that is up to you.
    
    15
    -
    
    16
    -This is an internal module. Please import 'Language.Haskell.TH.Quote' instead.
    
    17
    --}
    
    18
    -module GHC.Internal.TH.Quote(
    
    19
    -        QuasiQuoter(..),
    
    20
    -    ) where
    
    21
    -
    
    22
    -import GHC.Internal.TH.Syntax
    
    23
    -import GHC.Internal.TH.Monad
    
    24
    -import GHC.Internal.Base hiding (Type)
    
    25
    -
    
    26
    -
    
    27
    --- | The 'QuasiQuoter' type, a value @q@ of this type can be used
    
    28
    --- in the syntax @[q| ... string to parse ...|]@.  In fact, for
    
    29
    --- convenience, a 'QuasiQuoter' actually defines multiple quasiquoters
    
    30
    --- to be used in different splice contexts. In the usual case of a
    
    31
    --- @QuasiQuoter@ that is only intended to be used in certain splice
    
    32
    --- contexts, the unused fields should just 'fail'. This is most easily
    
    33
    --- accomplished using 'namedefaultQuasiQuoter' or 'defaultQuasiQuoter'.
    
    34
    ---
    
    35
    --- This is exposed both from the @template-haskell-quasiquoter@ and @template-haskell@ packages.
    
    36
    --- Consider importing it from the more stable @template-haskell-quasiquoter@ if you don't need the full breadth of the @template-haskell@ interface.
    
    37
    -data QuasiQuoter = QuasiQuoter {
    
    38
    -    -- | Quasi-quoter for expressions, invoked by quotes like @lhs = $[q|...]@
    
    39
    -    quoteExp  :: String -> Q Exp,
    
    40
    -    -- | Quasi-quoter for patterns, invoked by quotes like @f $[q|...] = rhs@
    
    41
    -    quotePat  :: String -> Q Pat,
    
    42
    -    -- | Quasi-quoter for types, invoked by quotes like @f :: $[q|...]@
    
    43
    -    quoteType :: String -> Q Type,
    
    44
    -    -- | Quasi-quoter for declarations, invoked by top-level quotes
    
    45
    -    quoteDec  :: String -> Q [Dec]
    
    46
    -    }

  • libraries/template-haskell-quasiquoter
    1
    -Subproject commit a47506eca032b139d9779fb8210d408c81d3fbd6
    1
    +Subproject commit e7c7af444a467fb8d56483583987002b43317576

  • testsuite/tests/linters/Makefile
    ... ... @@ -81,7 +81,6 @@ whitespace:
    81 81
     				libraries/base/include/HsEvent.h\
    
    82 82
     				libraries/base/include/md5.h\
    
    83 83
     				libraries/ghc-prim/GHC/Tuple.hs\
    
    84
    -				libraries/template-haskell/Language/Haskell/TH/Quote.hs\
    
    85 84
     				rts/STM.h\
    
    86 85
     				rts/Sparks.h\
    
    87 86
     				rts/Threads.h\
    

  • testsuite/tests/plugins/plugins10.stdout
    ... ... @@ -6,10 +6,9 @@ interfacePlugin: GHC.Internal.Base
    6 6
     interfacePlugin: GHC.Internal.Data.NonEmpty
    
    7 7
     interfacePlugin: GHC.Internal.Float
    
    8 8
     interfacePlugin: GHC.Internal.Prim.Ext
    
    9
    -interfacePlugin: GHC.Internal.TH.Quote
    
    9
    +interfacePlugin: GHC.Internal.TH.Monad
    
    10 10
     interfacePlugin: GHC.Internal.TH.Syntax
    
    11 11
     typeCheckPlugin (rn)
    
    12
    -interfacePlugin: GHC.Internal.TH.Monad
    
    13 12
     interfacePlugin: GHC.Internal.Stack.Types
    
    14 13
     interfacePlugin: GHC.Internal.Exception.Context
    
    15 14
     typeCheckPlugin (tc)
    

  • testsuite/tests/quotes/QQError.stderr
    1 1
     QQError.hs:5:12: error: [GHC-83865]
    
    2
    -    • Couldn't match expected type ‘GHC.Internal.TH.Quote.QuasiQuoter’
    
    2
    +    • Couldn't match expected type ‘GHC.Internal.TH.Monad.QuasiQuoter’
    
    3 3
                       with actual type ‘a1 -> a1’
    
    4 4
         • Probable cause: ‘id’ is applied to too few arguments
    
    5 5
           In the expression: [| [id|hello|] |]
    
    ... ... @@ -9,7 +9,7 @@ QQError.hs:5:12: error: [GHC-83865]
    9 9
       |            ^^
    
    10 10
     
    
    11 11
     QQError.hs:7:13: error: [GHC-83865]
    
    12
    -    • Couldn't match expected type ‘GHC.Internal.TH.Quote.QuasiQuoter’
    
    12
    +    • Couldn't match expected type ‘GHC.Internal.TH.Monad.QuasiQuoter’
    
    13 13
                       with actual type ‘a0 -> a0’
    
    14 14
         • Probable cause: ‘id’ is applied to too few arguments
    
    15 15
           In the expression: [| [id|hello|] |]
    

  • testsuite/tests/th/QQTopError.stderr
    1 1
     QQTopError.hs:4:9: error: [GHC-83865]
    
    2
    -    • Couldn't match expected type ‘GHC.Internal.TH.Quote.QuasiQuoter’
    
    2
    +    • Couldn't match expected type ‘GHC.Internal.TH.Monad.QuasiQuoter’
    
    3 3
                       with actual type ‘a0 -> a0’
    
    4 4
         • Probable cause: ‘id’ is applied to too few arguments
    
    5
    -      In the first argument of ‘GHC.Internal.TH.Quote.quoteExp’, namely
    
    5
    +      In the first argument of ‘GHC.Internal.TH.Monad.quoteExp’, namely
    
    6 6
             ‘id’
    
    7
    -      In the expression: GHC.Internal.TH.Quote.quoteExp id "hello"
    
    7
    +      In the expression: GHC.Internal.TH.Monad.quoteExp id "hello"
    
    8 8
           In the quasi-quotation: [id|hello|]
    
    9 9
       |
    
    10 10
     4 | main = [id|hello|]