packages feed

hakyll-dhall 0.2.1.3 → 0.2.2.0

raw patch · 3 files changed

+44/−16 lines, 3 filesdep ~dhallPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: dhall

API changes (from Hackage documentation)

+ Hakyll.Web.Dhall: renderDhallExprWith :: DhallCompilerOptions a -> Expr Src a -> Text
- Hakyll.Web.Dhall: dhallPrettyCompiler :: forall a. (DefaultDhallResolver a, Pretty a) => Compiler (Item String)
+ Hakyll.Web.Dhall: dhallPrettyCompiler :: forall a. DefaultDhallResolver a => Compiler (Item String)
- Hakyll.Web.Dhall: dhallPrettyCompilerWith :: Pretty a => DhallCompilerOptions a -> Compiler (Item String)
+ Hakyll.Web.Dhall: dhallPrettyCompilerWith :: DhallCompilerOptions a -> Compiler (Item String)

Files

CHANGELOG.md view
@@ -1,7 +1,17 @@ CHANGELOG ========= -Version 0.2.1.0+Version 0.2.2.0+---------------++*October 9, 2018*++<https://github.com/mstksg/backprop/releases/tag/v0.2.2.0>++*   Add `renderDhallExprWith`, to separate out functionality from+    `dhallPrettyCompilerWith`.++Version 0.2.1.X ---------------  *October 8, 2018*
hakyll-dhall.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 6f78bcd8cf9547efe49ede6a8b5c6e8faf541543464ec4193bf48dc8f42f7965+-- hash: 9602c81ff221ad25d8ecbf5a3b51eee5ebb1c79e801098acf6333c50faa1e506  name:           hakyll-dhall-version:        0.2.1.3+version:        0.2.2.0 synopsis:       Dhall compiler for Hakyll description:    Please see the README on GitHub at <https://github.com/mstksg/hakyll-dhall#readme> category:       Web
src/Hakyll/Web/Dhall.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE ConstraintKinds     #-} {-# LANGUAGE DeriveDataTypeable  #-} {-# LANGUAGE DeriveGeneric       #-} {-# LANGUAGE GADTs               #-} {-# LANGUAGE KindSignatures      #-} {-# LANGUAGE OverloadedStrings   #-}+{-# LANGUAGE RankNTypes          #-} {-# LANGUAGE RecordWildCards     #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections       #-}@@ -54,6 +56,7 @@   , dhallPrettyCompiler   , dhallRawPrettyCompiler, dhallFullPrettyCompiler   , dhallPrettyCompilerWith+  , renderDhallExprWith   -- * Configuration and Options   , DhallCompilerOptions(..), DhallCompilerTrust(..)   , defaultDhallCompilerOptions, dcoResolver, dcoMinimize, dcoNormalize@@ -137,7 +140,8 @@              . PP.layoutSmart layoutOpts              . PP.pretty @Import --- | Automatically "pretty prints" in multi-line form+-- | Automatically "pretty prints" in multi-line form.  For more+-- fine-grained results, see 'dhallPrettyCompilerWith' and family. instance PP.Pretty a => Writable (DExpr a) where     write fp e = withFile fp WriteMode $ \h ->       PP.renderIO h@@ -313,7 +317,7 @@ -- It might be more convenient to just use 'dhallRawCompiler' or -- 'dhallFullCompiler'. dhallPrettyCompiler-    :: forall a. (DefaultDhallResolver a, PP.Pretty a)+    :: forall a. DefaultDhallResolver a     => Compiler (Item String) dhallPrettyCompiler = dhallPrettyCompilerWith @a defaultDhallCompilerOptions @@ -336,19 +340,33 @@  -- | 'dhallPrettyCompiler', but with custom 'DhallCompilerOptions'. dhallPrettyCompilerWith-    :: PP.Pretty a-    => DhallCompilerOptions a+    :: DhallCompilerOptions a     -> Compiler (Item String) dhallPrettyCompilerWith dco = do     DExpr e <- itemBody <$> dExprCompilerWith dco-    makeItem $ T.unpack (disp e)+    makeItem . T.unpack $ renderDhallExprWith dco e++-- | Format and pretty-print an 'Expr' according to options in a given+-- 'DhallCompilerOptions'.+renderDhallExprWith+    :: DhallCompilerOptions a+    -> Expr Src a+    -> T.Text+renderDhallExprWith DCO{..} = case _dcoResolver of+    DRRaw  _ -> go+    DRFull _ -> go   where-    disp-      | _dcoMinimize dco = pretty-      | otherwise        = PP.renderStrict-                         . PP.layoutSmart layoutOpts-                         . PP.unAnnotate-                         . prettyExpr+    go :: (PP.Pretty a, Eq a) => Expr Src a -> T.Text+    go  | _dcoMinimize = pretty . norm+        | otherwise    = PP.renderStrict+                       . PP.layoutSmart layoutOpts+                       . PP.unAnnotate+                       . prettyExpr+                       . norm+     where+       norm+         | _dcoNormalize = normalize+         | otherwise     = id  -- | Compile the underlying text file as a Dhall expression, wrapped in -- a 'DExpr' newtype.  Mostly useful for pre-cacheing fully resolved Dhall@@ -382,11 +400,11 @@ -- different types later.  If you want to parse and immediately interpret, -- see 'dhallCompiler'. ----- _Note_: If the @a@ is not inferrable by type inference (like in the+-- _Note:_ If the @a@ is not inferrable by type inference (like in the -- situation above), you can specify the @a@ using type application syntax -- (like above). ----- _Note_: This isn't really meant to be a "final end-point", but if it is+-- _Note:_ This isn't really meant to be a "final end-point", but if it is -- used as such, a pretty-printed version will be rendered to the output -- directory, based on the 'Writable' instance of 'DExpr'. dExprCompiler :: DefaultDhallResolver a => Compiler (Item (DExpr a))