packages feed

th-env (empty) → 0.1.0.0

raw patch · 7 files changed

+132/−0 lines, 7 filesdep +basedep +markdown-unlitdep +template-haskellsetup-changed

Dependencies added: base, markdown-unlit, template-haskell, th-env

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Changelog++## [0.1.0.0] - 2019-05-01++[0.1.0.0]: https://github.com/dzhus/th-env/tree/0.1.0.0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Dmitry Dzhus (c) 2019++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * 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.++    * Neither the name of Dmitry Dzhus nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++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.
+ README.lhs view
@@ -0,0 +1,14 @@+# th-env++[![Travis CI build status](https://travis-ci.org/dzhus/th-env.svg)](https://travis-ci.org/dzhus/th-env)+[![Hackage](https://img.shields.io/hackage/v/th-env.svg?colorB=5e5184&style=flat)](https://hackage.haskell.org/package/th-env)+[![Hackage deps](https://img.shields.io/hackage-deps/v/th-env.svg)](http://packdeps.haskellers.com/feed?needle=th-env)++```haskell+{-# LANGUAGE TemplateHaskell #-}+import Data.Maybe+import Language.Haskell.TH.Env++main :: IO ()+main = print $ "Running app compiled by " ++ fromMaybe "?" $$(envQ "USER")+```
+ README.md view
@@ -0,0 +1,14 @@+# th-env++[![Travis CI build status](https://travis-ci.org/dzhus/th-env.svg)](https://travis-ci.org/dzhus/th-env)+[![Hackage](https://img.shields.io/hackage/v/th-env.svg?colorB=5e5184&style=flat)](https://hackage.haskell.org/package/th-env)+[![Hackage deps](https://img.shields.io/hackage-deps/v/th-env.svg)](http://packdeps.haskellers.com/feed?needle=th-env)++```haskell+{-# LANGUAGE TemplateHaskell #-}+import Data.Maybe+import Language.Haskell.TH.Env++main :: IO ()+main = print $ "Running app compiled by " ++ fromMaybe "?" $$(envQ "USER")+```
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Language/Haskell/TH/Env.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Language.Haskell.TH.Env (envQ)++where++import Data.String+import Language.Haskell.TH+import System.Environment++-- | Produce a typed expression with the current value of an+-- environment variable.+envQ :: IsString a+     => String+     -- ^ Environment variable name.+     -> TExpQ (Maybe a)+envQ name =+  runIO (lookupEnv name) >>= \case+    Just v  -> [|| Just (fromString v) ||]+    Nothing -> [|| Nothing ||]
+ th-env.cabal view
@@ -0,0 +1,45 @@+cabal-version: 1.12+name: th-env+version: 0.1.0.0+license: BSD3+license-file: LICENSE+maintainer: dima@dzhus.org+author: Dmitry Dzhus+homepage: https://github.com/dzhus/th-env#readme+bug-reports: https://github.com/dzhus/th-env/issues+synopsis: Template Haskell splice that expands to an environment variable+description:+    TH splice that expands to an environment variable value. Can be used to embed build-time parameters in your application.+category: Template Haskell+build-type: Simple+extra-source-files:+    CHANGELOG.md+    README.md++source-repository head+    type: git+    location: https://github.com/dzhus/th-env++library+    exposed-modules:+        Language.Haskell.TH.Env+    hs-source-dirs: src+    other-modules:+        Paths_th_env+    default-language: Haskell2010+    ghc-options: -Wall -Wcompat+    build-depends:+        base <5,+        template-haskell <2.15++test-suite readme+    type: exitcode-stdio-1.0+    main-is: README.lhs+    other-modules:+        Paths_th_env+    default-language: Haskell2010+    ghc-options: -Wall -Wcompat -pgmL markdown-unlit+    build-depends:+        base <5,+        markdown-unlit <0.6,+        th-env -any