packages feed

conferer-source-dhall (empty) → 0.4.0.0

raw patch · 6 files changed

+115/−0 lines, 6 filesdep +basedep +bytestringdep +conferersetup-changed

Dependencies added: base, bytestring, conferer, conferer-source-dhall, conferer-source-json, dhall, dhall-json, directory, hspec, text

Files

+ LICENSE view
@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2019 Lucas David Traverso++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++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 OR COPYRIGHT HOLDERS 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.
+ README.md view
@@ -0,0 +1,1 @@+# conferer-source-dhall
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ conferer-source-dhall.cabal view
@@ -0,0 +1,64 @@+cabal-version: 1.18++-- This file has been generated from package.yaml by hpack version 0.33.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 3a6324af0c2118691220e9cad23738fef03d28cb54a17e8994ff6d7149129731++name:           conferer-source-dhall+version:        0.4.0.0+synopsis:       Configuration for reading dhall files++description:    Library to abstract the parsing of many haskell config values from different config sources+category:       Configuration+homepage:       https://github.com/ludat/conferer#readme+author:         Lucas David Traverso+maintainer:     lucas6246@gmail.com+copyright:      MIT+license:        BSD3+license-file:   LICENSE+build-type:     Simple+extra-doc-files:+    README.md+    LICENSE++library+  exposed-modules:+      Conferer.Source.Dhall+  other-modules:+      Paths_conferer_source_dhall+  hs-source-dirs:+      src+  default-extensions: OverloadedStrings LambdaCase QuasiQuotes ScopedTypeVariables+  build-depends:+      base >=4.3 && <5+    , bytestring >=0.10 && <0.11+    , conferer >=0.4.0.0 && <0.5.0.0+    , conferer-source-json >=0.4.0.0 && <0.5.0.0+    , dhall >=1.8 && <2.0+    , dhall-json >=1.0 && <2.0+    , directory >=1.2 && <2.0+    , text >=1.1 && <1.3+  default-language: Haskell2010++test-suite specs+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  other-modules:+      Paths_conferer_source_dhall+  hs-source-dirs:+      test+  default-extensions: OverloadedStrings LambdaCase QuasiQuotes ScopedTypeVariables+  build-depends:+      base >=4.3 && <5+    , bytestring >=0.10 && <0.11+    , conferer >=0.4.0.0 && <0.5.0.0+    , conferer-source-dhall+    , conferer-source-json >=0.4.0.0 && <0.5.0.0+    , dhall >=1.8 && <2.0+    , dhall-json >=1.0 && <2.0+    , directory >=1.2 && <2.0+    , hspec+    , text >=1.1 && <1.3+  default-language: Haskell2010
+ src/Conferer/Source/Dhall.hs view
@@ -0,0 +1,26 @@+module Conferer.Source.Dhall where++import qualified Data.Text.IO as Text+import           Dhall+import           Dhall.JSON+import           System.Directory (doesFileExist)+import           Conferer.Source.JSON+import           Conferer.Source.Files+import           Conferer.Source.Null++import           Conferer.Types++mkDhallSource :: SourceCreator+mkDhallSource config = do+  filePath <- getFilePathFromEnv config "dhall"+  fileExists <- doesFileExist filePath+  if fileExists+    then do+    fileContent <- Text.readFile filePath+    dahllExpr <- inputExpr fileContent+    case dhallToJSON dahllExpr of+      Right jsonConfig -> do+        mkJsonSource' jsonConfig config+      Left compileError -> error (show compileError)+    else do+      mkNullSource config
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}