packages feed

servant-dhall 0.1.0.2 → 0.3

raw patch · 3 files changed

+33/−21 lines, 3 filesdep +eitherdep ~basedep ~base-compatdep ~dhallPVP ok

version bump matches the API change (PVP)

Dependencies added: either

Dependency ranges changed: base, base-compat, dhall, megaparsec, prettyprinter, servant, servant-server, warp

API changes (from Hackage documentation)

- Servant.Dhall: instance (Dhall.Inject a, Servant.Dhall.HasInterpretOptions opts) => Servant.API.ContentTypes.MimeRender (Servant.Dhall.DHALL' opts) a
- Servant.Dhall: instance (Dhall.Interpret a, Servant.Dhall.HasInterpretOptions opts) => Servant.API.ContentTypes.MimeUnrender (Servant.Dhall.DHALL' opts) a
+ Servant.Dhall: instance (Dhall.FromDhall a, Servant.Dhall.HasInterpretOptions opts) => Servant.API.ContentTypes.MimeUnrender (Servant.Dhall.DHALL' opts) a
+ Servant.Dhall: instance (Dhall.ToDhall a, Servant.Dhall.HasInterpretOptions opts) => Servant.API.ContentTypes.MimeRender (Servant.Dhall.DHALL' opts) a

Files

CHANGELOG.md view
@@ -1,6 +1,15 @@+# 0.3++- Use `dhall ==1.29`+- Support servant-0.17++# 0.2++- Use `dhall ==1.26`+ # 0.1.0.2 -- Use `dhall ==0.20.*`+- Use `dhall ==1.20.*` - Support servant-0.16  # 0.1.0.1
servant-dhall.cabal view
@@ -1,6 +1,6 @@ cabal-version:      >=1.10 name:               servant-dhall-version:            0.1.0.2+version:            0.3 synopsis:           Servant Dhall content-type description:   Servant Dhall bindings.@@ -19,7 +19,7 @@ category:           Web, Servant, Dhall build-type:         Simple bug-reports:        http://github.com/haskell-servant/servant-dhall/issues-tested-with:        GHC ==8.6.3 || ==8.4.3 || ==8.0.2 || ==8.2.2+tested-with:        GHC ==8.0.2 || ==8.2.2 || ==8.4.3 || ==8.6.5 || ==8.8.2 extra-source-files:   README.md   CHANGELOG.md@@ -31,14 +31,15 @@ library   exposed-modules:  Servant.Dhall   build-depends:-      base           >=4.9      && <4.13-    , base-compat    >=0.10.1   && <0.11+      base           >=4.9      && <4.14+    , base-compat    >=0.10.1   && <0.12     , bytestring     >=0.10.4.0 && <0.11-    , dhall          >=1.20.1   && <1.21-    , http-media     >=0.7.1.2  && <0.8-    , megaparsec     >=7.0.4    && <7.1-    , prettyprinter  >=1.2.0.1  && <1.3-    , servant        >=0.13     && <0.17+    , dhall          >=1.29.0   && <1.30+    , either         >=5.0.1.1  && <5.1+    , http-media     >=0.7.1.2  && <0.9+    , megaparsec     >=7.0.4    && <8.1+    , prettyprinter  >=1.5.1    && <1.7+    , servant        >=0.17     && <0.18     , text           >=1.2.3.0  && <1.3    hs-source-dirs:   src@@ -58,8 +59,8 @@     , http-media     , servant     , servant-dhall-    , servant-server  >=0.12     && <0.17+    , servant-server  >=0.12     && <0.18     , wai             >=3.0.3.0  && <3.3-    , warp            >=3.0.13.1 && <3.3+    , warp            >=3.0.13.1 && <3.4    default-language: Haskell2010
src/Servant/Dhall.hs view
@@ -27,6 +27,8 @@  import           Control.Monad                  (unless)+import           Data.Either.Validation+                 (Validation (..)) import           Data.Proxy                  (Proxy (..)) import           Data.Text.Encoding.Error@@ -45,8 +47,8 @@ import           Data.Typeable                  (Typeable) import           Dhall-                 (Inject (..), InputType (..), Interpret (..),-                 InterpretOptions, Type (..), defaultInterpretOptions)+                 (ToDhall (..), Encoder (..), FromDhall (..),+                 InterpretOptions, Decoder (..), defaultInterpretOptions) import qualified Dhall.Core import           Dhall.Parser                  (exprFromText, unwrap)@@ -66,7 +68,7 @@ -- Encoding ------------------------------------------------------------------------------- -instance (Inject a, HasInterpretOptions opts) => MimeRender (DHALL' opts) a where+instance (ToDhall a, HasInterpretOptions opts) => MimeRender (DHALL' opts) a where     mimeRender _ x         = TLE.encodeUtf8         $ renderLazy@@ -75,14 +77,14 @@         $ pretty         $ embed ty x       where-        ty :: InputType a+        ty :: Encoder a         ty = injectWith (interpretOptions (Proxy :: Proxy opts))  ------------------------------------------------------------------------------- -- Decoding ------------------------------------------------------------------------------- -instance (Interpret a, HasInterpretOptions opts) => MimeUnrender (DHALL' opts) a where+instance (FromDhall a, HasInterpretOptions opts) => MimeUnrender (DHALL' opts) a where     mimeUnrender _ lbs = do         expr0  <- firstEither showParseError $ exprFromText "(input)" te         expr1  <- for expr0 $ \i -> Left $ "Import found: " ++ ppExpr i@@ -90,9 +92,9 @@         unless (Dhall.Core.judgmentallyEqual tyExpr $ expected ty) $             Left $ "Expected and actual types don't match : "                 ++ ppExpr (expected ty) ++ " /= " ++ ppExpr tyExpr-        case extract ty (Dhall.Core.normalizeWith (const (pure Nothing)) expr1) of-            Just x  -> Right x-            Nothing -> Left "Invalid type"+        case extract ty (Dhall.Core.normalizeWith Nothing expr1) of+             Success x -> Right x+             Failure _ -> Left "Invalid type"       where         showParseError = MP.errorBundlePretty . unwrap         showTypeError e = "Type error: " ++ ppExpr e@@ -100,7 +102,7 @@         te = TL.toStrict $             TLE.decodeUtf8With lenientDecode lbs -        ty :: Type a+        ty :: Decoder  a         ty = autoWith (interpretOptions (Proxy :: Proxy opts))          ppExpr :: Pretty pp => pp -> String