servant-to-elm 0.3.0.0 → 0.3.1.0
raw patch · 5 files changed
+21/−14 lines, 5 filesdep ~elm-syntaxdep ~haskell-to-elmPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: elm-syntax, haskell-to-elm
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- README.md +4/−3
- examples/UserAPI.hs +3/−1
- servant-to-elm.cabal +8/−8
- src/Servant/To/Elm.hs +2/−2
CHANGELOG.md view
@@ -2,6 +2,10 @@ ## Unreleased changes +## 0.3.1.0++- Update to `elm-syntax-0.2.0.0`, adding simplification of the generated definitions.+ ## 0.3.0.0 - Add support for multipart forms
README.md view
@@ -27,7 +27,8 @@ <> jsonDefinitions @User modules =- Pretty.modules definitions+ Pretty.modules $+ Simplification.simplifyDefinition <$> definitions forM_ (HashMap.toList modules) $ \(_moduleName, contents) -> print contents@@ -50,7 +51,7 @@ getUser = Http.request { method = "GET" , headers = []- , url = String.join "/" [Config.urlBase, "user"]+ , url = Config.urlBase ++ "/user" , body = Http.emptyBody , expect = Http.expectStringResponse identity (\a -> case a of Http.BadUrl_ b ->@@ -77,7 +78,7 @@ postUser a = Http.request { method = "POST" , headers = []- , url = String.join "/" [Config.urlBase, "user"]+ , url = Config.urlBase ++ "/user" , body = Http.jsonBody (Api.User.encoder a) , expect = Http.expectStringResponse identity (\b -> case b of Http.BadUrl_ c ->
examples/UserAPI.hs view
@@ -16,6 +16,7 @@ import Servant.API import qualified Language.Elm.Pretty as Pretty+import qualified Language.Elm.Simplification as Simplification import Language.Haskell.To.Elm import Servant.To.Elm @@ -48,7 +49,8 @@ <> jsonDefinitions @User modules =- Pretty.modules definitions+ Pretty.modules $+ Simplification.simplifyDefinition <$> definitions forM_ (HashMap.toList modules) $ \(_moduleName, contents) -> print contents
servant-to-elm.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 93b2674b01cbea25b894fcbcb2d07f0308d2c535ba76a81fd6831bda6deb39cb+-- hash: 9bc8ea51733447a3197fbc2ff1b7df7f9e35bd30ad2a262087efea102701806b name: servant-to-elm-version: 0.3.0.0+version: 0.3.1.0 synopsis: Automatically generate Elm clients for Servant APIs description: Please see the README on GitHub at <https://github.com/folq/servant-to-elm#readme> category: Servant, API, Elm, Compiler@@ -44,8 +44,8 @@ aeson >=1.4.0 , base >=4.7 && <5 , bound >=2.0.0- , elm-syntax >=0.1.0 && <0.1.1- , haskell-to-elm >=0.2.0 && <0.2.1+ , elm-syntax >=0.2.0 && <0.2.1+ , haskell-to-elm >=0.2.0 && <0.2.2 , http-types >=0.12.0 , protolude >=0.2.3 , servant >=0.16.0@@ -64,9 +64,9 @@ aeson >=1.4.0 , base >=4.7 && <5 , bound >=2.0.0- , elm-syntax >=0.1.0 && <0.1.1+ , elm-syntax >=0.2.0 && <0.2.1 , generics-sop- , haskell-to-elm >=0.2.0 && <0.2.1+ , haskell-to-elm >=0.2.0 && <0.2.2 , http-types >=0.12.0 , protolude >=0.2.3 , servant@@ -90,8 +90,8 @@ aeson >=1.4.0 , base >=4.7 && <5 , bound >=2.0.0- , elm-syntax >=0.1.0 && <0.1.1- , haskell-to-elm >=0.2.0 && <0.2.1+ , elm-syntax >=0.2.0 && <0.2.1+ , haskell-to-elm >=0.2.0 && <0.2.2 , http-types >=0.12.0 , protolude >=0.2.3 , servant >=0.16.0
src/Servant/To/Elm.hs view
@@ -186,7 +186,7 @@ ] Flag ->- Expression.If+ Expression.if_ (pure $ paramArgName i) (Expression.List [Expression.String name]) (Expression.List [])@@ -323,7 +323,7 @@ , ( Pattern.Con "Http.GoodStatus_" [Pattern.Var 0, Pattern.Var 1] , Bound.toScope $ if fmap _decodedType (_returnType endpoint) == Just (elmType @Servant.NoContent) then- Expression.If (Expression.apps ("Basics.==") [pure $ Bound.B 1, Expression.String ""])+ Expression.if_ (Expression.apps ("Basics.==") [pure $ Bound.B 1, Expression.String ""]) (Expression.App "Result.Ok" "NoContent.NoContent") (Expression.App "Result.Err" $ Expression.tuple