packages feed

hpack-dhall 0.1.0 → 0.2.0

raw patch · 2 files changed

+18/−16 lines, 2 filesdep +megaparsecdep −trifectadep ~hpack

Dependencies added: megaparsec

Dependencies removed: trifecta

Dependency ranges changed: hpack

Files

hpack-dhall.cabal view
@@ -1,17 +1,17 @@--- This file has been generated from package.yaml by hpack version 0.23.0.+-- This file has been generated from package.yaml by hpack version 0.28.2. -- -- see: https://github.com/sol/hpack ----- hash: c298d477b6c09e70c97fdc47ae58b23f965424ab7ecd301c4ab4372a2851cbe7+-- hash: 38e9ec5002ffc1e15956dcc564f84f57658610a5204fec5ff56d76d098689a1f  name:           hpack-dhall-version:        0.1.0+version:        0.2.0 synopsis:       Dhall support for Hpack-description:    This package allows you to use the Dhall configuration language to specify-                Haskell packages.+description:    This package allows you to use the Dhall configuration language to specify Haskell packages. category:       Development homepage:       https://github.com/sol/hpack-dhall#readme bug-reports:    https://github.com/sol/hpack-dhall/issues+maintainer:     Simon Hengel <sol@typeful.net> license:        PublicDomain build-type:     Simple cabal-version:  >= 1.10@@ -34,10 +34,10 @@     , base ==4.*     , dhall     , dhall-json-    , hpack >=0.23.0+    , hpack >=0.26.0+    , megaparsec     , text     , transformers-    , trifecta   default-language: Haskell2010  test-suite spec@@ -56,11 +56,11 @@     , base ==4.*     , dhall     , dhall-json-    , hpack >=0.23.0+    , hpack >=0.26.0     , hspec ==2.*     , interpolate+    , megaparsec     , mockery     , text     , transformers-    , trifecta   default-language: Haskell2010
src/Hpack/Dhall.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoMonomorphismRestriction #-} module Hpack.Dhall where @@ -6,9 +7,7 @@ import           Data.Bifunctor import           Data.Aeson import qualified Data.Text.Lazy.IO as LT-import qualified Data.Text as T-import           Data.Text.Encoding (encodeUtf8)-import           Text.Trifecta.Delta (Delta(..))+import           System.Environment import qualified Dhall.Parser import qualified Dhall.Import import qualified Dhall.TypeCheck@@ -19,15 +18,18 @@ packageConfig :: FilePath packageConfig = "package.dhall" -readDhall :: FilePath -> IO (Either String Value)-readDhall file = runExceptT $ do+decodeDhall :: FilePath -> IO (Either String Value)+decodeDhall file = runExceptT $ do   expr <- readInput >>= parseExpr >>= liftIO . Dhall.Import.load   _ <- liftResult $ Dhall.TypeCheck.typeOf expr   liftResult $ Dhall.JSON.dhallToJSON expr   where     readInput = liftIO (LT.readFile file)-    parseExpr = liftResult . Dhall.Parser.exprFromText (Directed (encodeUtf8 $ T.pack file) 0 0 0 0)+    parseExpr = liftResult . Dhall.Parser.exprFromText file     liftResult = ExceptT . return . first show  main :: IO ()-main = Hpack.mainWith packageConfig readDhall+main = do+  getArgs >>= Hpack.getOptions packageConfig >>= \ case+    Just (verbose, options) -> Hpack.hpack verbose (Hpack.setDecode decodeDhall options)+    Nothing -> return ()