packages feed

template-haskell-quasiquoter (empty) → 0.1.0.0

raw patch · 4 files changed

+135/−0 lines, 4 filesdep +basedep +ghc-internaldep +template-haskell

Dependencies added: base, ghc-internal, template-haskell

Files

+ CHANGELOG.md view
@@ -0,0 +1,6 @@+# Revision history for template-haskell-quote++## 0.1.0.0 -- YYYY-mm-dd++* First version. Released on an unsuspecting world.+  Implements [GHC Proposal 696](https://github.com/ghc-proposals/ghc-proposals/pull/696)
+ LICENSE view
@@ -0,0 +1,26 @@+Copyright (c) 2024, Teo Camarasu+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the+   distribution.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ src/Language/Haskell/TH/QuasiQuoter.hs view
@@ -0,0 +1,72 @@+{-# LANGUAGE Safe #-}+{-# LANGUAGE CPP #-}++module Language.Haskell.TH.QuasiQuoter+  ( QuasiQuoter (QuasiQuoter, quoteExp, quotePat, quoteType, quoteDec)+  , namedDefaultQuasiQuoter+  , defaultQuasiQuoter+  , Q+  , Exp+  , Pat+  , Type+  , Dec+  ) where++#if __GLASGOW_HASKELL__ >= 912+import GHC.Internal.TH.Quote (QuasiQuoter(..))+import GHC.Internal.TH.Syntax (Exp, Q, Pat, Type, Dec)+#else+import Language.Haskell.TH.Quote (QuasiQuoter(..))+import Language.Haskell.TH.Syntax (Exp, Q, Pat, Type, Dec)+#endif++-- | A t'QuasiQuoter' that fails with a helpful error message in every+-- context. It is intended to be modified to create a t'QuasiQuoter' that+-- fails in all inappropriate contexts.+--+-- For example, you could write+--+-- @+-- myPatQQ = (namedDefaultQuasiQuoter "myPatQQ")+--   { quotePat = ... }+-- @+--+-- If @myPatQQ@ is used in an expression context, the compiler will report+-- that, naming @myPatQQ@.+--+-- See also 'defaultQuasiQuoter', which does not name the t'QuasiQuoter' in+-- the error message, and might therefore be more appropriate when+-- the users of a particular t'QuasiQuoter' tend to define local \"synonyms\"+-- for it.+namedDefaultQuasiQuoter :: String -> QuasiQuoter+namedDefaultQuasiQuoter name = QuasiQuoter+  { quoteExp = f "use in expression contexts."+  , quotePat = f "use in pattern contexts."+  , quoteType = f "use in types."+  , quoteDec = f "creating declarations."+  }+  where+    f m _ = fail $ "The " ++ name ++ " quasiquoter is not for " ++ m++-- | A t'QuasiQuoter' that fails with a helpful error message in every+-- context. It is intended to be modified to create a t'QuasiQuoter' that+-- fails in all inappropriate contexts.+--+-- For example, you could write+--+-- @+-- myExpressionQQ = defaultQuasiQuoter+--   { quoteExp = ... }+-- @+--+-- See also 'namedDefaultQuasiQuoter', which names the t'QuasiQuoter' in the+-- error messages.+defaultQuasiQuoter :: QuasiQuoter+defaultQuasiQuoter = QuasiQuoter+  { quoteExp = f "use in expression contexts."+  , quotePat = f "use in pattern contexts."+  , quoteType = f "use in types."+  , quoteDec = f "creating declarations."+  }+  where+    f m _ = fail $ "This quasiquoter is not for " ++ m
+ template-haskell-quasiquoter.cabal view
@@ -0,0 +1,31 @@+cabal-version:      3.0+name:               template-haskell-quasiquoter+version:            0.1.0.0+synopsis: The 'QuasiQuoter' interface.+description: The stable home of TemplateHaskell's 'QuasiQuoter' interface.+category: Development+license: BSD-2-Clause+license-file: LICENSE+author: Teo Camarasu+maintainer: Teo Camarasu <teofilcamarasu@gmail.com>, GHC developers <ghc-devs@haskell.org>+copyright:          template-haskell-quasiquoter Contributors+bug-reports: https://gitlab.haskell.org/ghc/template-haskell-quasiquoter/-/issues+build-type:         Simple+extra-doc-files:    CHANGELOG.md+tested-with:+  ghc ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.2 || ==9.12.2++source-repository head+  type: git+  location: https://gitlab.haskell.org/ghc/template-haskell-lift.git++library+    ghc-options: -Wall+    exposed-modules:  Language.Haskell.TH.QuasiQuoter+    build-depends: base >=4.14 && <4.22 +    if impl(ghc>=9.12)+      build-depends: ghc-internal >=9.1000 && <9.1600+    else+      build-depends: template-haskell >=2.16 && <2.23+    hs-source-dirs:   src+    default-language: Haskell2010