packages feed

elm-bridge 0.5.1 → 0.5.2

raw patch · 6 files changed

+34/−2 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# v0.5.2++ * Fix a bug about tuples.+ # v0.5.0   * Large change for sum types that used `constructorTagModifier`. The generated types are now unaffected! This is a breaking change for those who used this feature.
README.md view
@@ -83,6 +83,10 @@  * `elm package install bartavelle/json-helpers` +or, for Elm 0.19:++* `elm install bartavelle/json-helpers`+ ## Contribute  Pull requests are welcome! Please consider creating an issue beforehand, so we can discuss what you would like to do. Code should be written in a consistent style throughout the project. Avoid whitespace that is sensible to conflicts. (E.g. alignment of `=` signs in functions definitions) Note that by sending a pull request you agree that your contribution can be released under the BSD3 License as part of the `elm-bridge` package or related packages.
elm-bridge.cabal view
@@ -1,5 +1,5 @@ name:                elm-bridge-version:             0.5.1+version:             0.5.2 synopsis:            Derive Elm types and Json code from Haskell types, using aeson's options description:         Building the bridge from Haskell to Elm and back. Define types once,                      and derive the aeson and elm functions at the same time, using any aeson@@ -59,6 +59,7 @@                        Elm.TyRenderSpec                        Elm.JsonSpec                        Elm.ModuleSpec+                       Elm.TyRepSpec   build-depends:                        base,                        hspec >= 2.0,
src/Elm/TyRep.hs view
@@ -175,7 +175,7 @@             -- List is special because the constructor name is [] in Haskell and List in elm           | con == (typeRepTyCon $ typeRep (Proxy :: Proxy [])) = ETyApp (ETyCon $ ETCon $ "List") (toElmType' (head args))             -- The unit type '()' is a 0-ary tuple.-          | isTuple $ tyConName con = ETyTuple $ length args+          | isTuple $ tyConName con = foldl ETyApp (ETyTuple $ length args) $ map toElmType' args           | otherwise = typeApplication con args             where                 (con, args) = splitTyConApp rep
+ test/Elm/TyRepSpec.hs view
@@ -0,0 +1,21 @@+module Elm.TyRepSpec (spec) where++import Elm.TyRep++import Data.Proxy+import Test.Hspec++spec :: Spec+spec =+    describe "toElmType" $+      it "should produce the correct code" $+      do toElmType (Proxy :: Proxy Int) `shouldBe` ETyCon (ETCon "Int")+         toElmType (Proxy :: Proxy Float) `shouldBe` ETyCon (ETCon "Float")+         toElmType (Proxy :: Proxy String) `shouldBe` ETyCon (ETCon "String")+         toElmType (Proxy :: Proxy Bool) `shouldBe` ETyCon (ETCon "Bool")+         toElmType (Proxy :: Proxy Char) `shouldBe` ETyCon (ETCon "Char")+         toElmType (Proxy :: Proxy [Int]) `shouldBe` ETyApp (ETyCon $ ETCon "List") (ETyCon $ ETCon "Int")+         toElmType (Proxy :: Proxy (Maybe Int)) `shouldBe` ETyApp (ETyCon $ ETCon "Maybe") (ETyCon $ ETCon "Int")+         toElmType (Proxy :: Proxy ()) `shouldBe` ETyTuple 0+         toElmType (Proxy :: Proxy (Int, Bool)) `shouldBe` ETyApp (ETyApp (ETyTuple 2) (ETyCon $ ETCon "Int")) (ETyCon $ ETCon "Bool")+         toElmType (Proxy :: Proxy (Int, Bool, String)) `shouldBe` ETyApp (ETyApp (ETyApp (ETyTuple 3) (ETyCon $ ETCon "Int")) (ETyCon $ ETCon "Bool")) (ETyCon $ ETCon "String")
test/Spec.hs view
@@ -4,6 +4,7 @@ import qualified Elm.TyRenderSpec import qualified Elm.JsonSpec import qualified Elm.ModuleSpec+import qualified Elm.TyRepSpec  import Test.Hspec @@ -13,3 +14,4 @@   describe "Elm.TyRenderSpec" Elm.TyRenderSpec.spec   describe "Elm.JsonSpec" Elm.JsonSpec.spec   describe "Elm.ModuleSpec" Elm.ModuleSpec.spec+  describe "Elm.TyRepSpec" Elm.TyRepSpec.spec