heredoc (empty) → 0.1.0.0
raw patch · 4 files changed
+83/−0 lines, 4 filesdep +basedep +template-haskellsetup-changed
Dependencies added: base, template-haskell
Files
- LICENSE.txt +24/−0
- Setup.hs +2/−0
- heredoc.cabal +21/−0
- src/Text/Here.hs +36/−0
+ LICENSE.txt view
@@ -0,0 +1,24 @@+This is free and unencumbered software released into the public domain.++Anyone is free to copy, modify, publish, use, compile, sell, or+distribute this software, either in source code form or as a compiled+binary, for any purpose, commercial or non-commercial, and by any+means.++In jurisdictions that recognize copyright laws, the author or authors+of this software dedicate any and all copyright interest in the+software to the public domain. We make this dedication for the benefit+of the public at large and to the detriment of our heirs and+successors. We intend this dedication to be an overt act of+relinquishment in perpetuity of all present and future rights to this+software under copyright law.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.++For more information, please refer to <http://unlicense.org/>
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ heredoc.cabal view
@@ -0,0 +1,21 @@+name: heredoc+version: 0.1.0.0+synopsis: multi-line string / here document using QuasiQuotes++license: PublicDomain+license-file: LICENSE.txt++author: James H. Fisher+maintainer: jameshfisher@gmail.com++category: Text++build-type: Simple+cabal-version: >=1.8++library+ exposed-modules: Text.Here+ build-depends:+ base >= 4 && < 5,+ template-haskell >= 2.5+ hs-source-dirs: src
+ src/Text/Here.hs view
@@ -0,0 +1,36 @@+module Text.Here (here, there) where++import Language.Haskell.TH+ ( litE+ , stringL+ )++import Language.Haskell.TH.Quote+ ( QuasiQuoter+ ( QuasiQuoter+ , quoteExp+ , quotePat+ , quoteType+ , quoteDec+ )+ , quoteFile+ )++err :: String -> String+err ctx =+ "You have used the `here` QuasiQuoter in a " ++ ctx ++ " context; " +++ "you must only use it as a string literal expression"++-- | Create a string-literal expression from the string being quoted.+here :: QuasiQuoter+here = QuasiQuoter+ { quoteExp = litE . stringL+ , quotePat = const $ error $ err "pattern"+ , quoteType = const $ error $ err "type"+ , quoteDec = const $ error $ err "declaration"+ }++-- | Create a string-literal expression from+-- the contents of the file at the filepath being quoted.+there :: QuasiQuoter+there = quoteFile here