packages feed

elm-export 0.4.1.0 → 0.4.1.1

raw patch · 14 files changed

+205/−2 lines, 14 filesdep ~elm-exportPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: elm-export

API changes (from Hackage documentation)

Files

elm-export.cabal view
@@ -1,5 +1,5 @@ name: elm-export-version: 0.4.1.0+version: 0.4.1.1 cabal-version: >=1.10 build-type: Simple license: OtherLicense@@ -13,6 +13,8 @@     Generate Elm source code automatically from Haskell types. Using GHC.Generics, we can automatically derive Elm type declarations, and Aeson-compatible JSON decoders & encoders. category: Web author: Kris Jenkins+extra-source-files:+    test/*.elm  source-repository head     type: git@@ -48,7 +50,7 @@         base >=4.8.2.0 && <4.9,         bytestring >=0.10.6.0 && <0.11,         containers >=0.5.6.2 && <0.6,-        elm-export >=0.4.1.0 && <0.5,+        elm-export >=0.4.1.1 && <0.5,         hspec >=2.2.2 && <2.3,         hspec-core >=2.2.2 && <2.3,         quickcheck-instances >=0.3.12 && <0.4,
+ test/CommentDecoder.elm view
@@ -0,0 +1,18 @@+module CommentDecoder exposing (..)++import CommentType exposing (..)+import Date+import Dict+import Json.Decode exposing (..)+import Json.Decode.Pipeline exposing (..)+++decodeComment : Decoder Comment+decodeComment =+    decode Comment+        |> required "postId" int+        |> required "text" string+        |> required "mainCategories" (tuple2 (,) string string)+        |> required "published" bool+        |> required "created" (customDecoder string Date.fromString)+        |> required "tags" (map Dict.fromList (list (tuple2 (,) string int)))
+ test/CommentDecoderWithOptions.elm view
@@ -0,0 +1,18 @@+module CommentDecoderWithOptions exposing (..)++import CommentType exposing (..)+import Date+import Dict+import Json.Decode exposing (..)+import Json.Decode.Pipeline exposing (..)+++decodeComment : Decoder Comment+decodeComment =+    decode Comment+        |> required "commentPostId" int+        |> required "commentText" string+        |> required "commentMainCategories" (tuple2 (,) string string)+        |> required "commentPublished" bool+        |> required "commentCreated" (customDecoder string Date.fromString)+        |> required "commentTags" (map Dict.fromList (list (tuple2 (,) string int)))
+ test/CommentEncoder.elm view
@@ -0,0 +1,18 @@+module CommentEncoder exposing (..)++import CommentType exposing (..)+import Exts.Date exposing (..)+import Exts.Json.Encode exposing (..)+import Json.Encode exposing (..)+++encodeComment : Comment -> Value+encodeComment x =+    object+        [ ( "postId", int x.postId )+        , ( "text", string x.text )+        , ( "mainCategories", tuple2 string string x.mainCategories )+        , ( "published", bool x.published )+        , ( "created", (string << toISOString) x.created )+        , ( "tags", dict string int x.tags )+        ]
+ test/CommentEncoderWithOptions.elm view
@@ -0,0 +1,18 @@+module CommentEncoderWithOptions exposing (..)++import CommentType exposing (..)+import Exts.Date exposing (..)+import Exts.Json.Encode exposing (..)+import Json.Encode exposing (..)+++encodeComment : Comment -> Value+encodeComment x =+    object+        [ ( "commentPostId", int x.postId )+        , ( "commentText", string x.text )+        , ( "commentMainCategories", tuple2 string string x.mainCategories )+        , ( "commentPublished", bool x.published )+        , ( "commentCreated", (string << toISOString) x.created )+        , ( "commentTags", dict string int x.tags )+        ]
+ test/CommentType.elm view
@@ -0,0 +1,14 @@+module CommentType exposing (..)++import Date exposing (Date)+import Dict exposing (Dict)+++type alias Comment =+    { postId : Int+    , text : String+    , mainCategories : ( String, String )+    , published : Bool+    , created : Date+    , tags : Dict String Int+    }
+ test/CommentTypeWithOptions.elm view
@@ -0,0 +1,14 @@+module CommentTypeWithOptions exposing (..)++import Date exposing (Date)+import Dict exposing (Dict)+++type alias Comment =+    { commentPostId : Int+    , commentText : String+    , commentMainCategories : ( String, String )+    , commentPublished : Bool+    , commentCreated : Date+    , commentTags : Dict String Int+    }
+ test/PositionType.elm view
@@ -0,0 +1,7 @@+module PositionType exposing (..)+++type Position+    = Beginning+    | Middle+    | End
+ test/PostDecoder.elm view
@@ -0,0 +1,17 @@+module PostDecoder exposing (..)++import CommentDecoder exposing (..)+import Json.Decode exposing (..)+import Json.Decode.Pipeline exposing (..)+import PostType exposing (..)+++decodePost : Decoder Post+decodePost =+    decode Post+        |> required "id" int+        |> required "name" string+        |> required "age" (maybe float)+        |> required "comments" (list decodeComment)+        |> required "promoted" (maybe decodeComment)+        |> required "author" (maybe string)
+ test/PostDecoderWithOptions.elm view
@@ -0,0 +1,17 @@+module PostDecoderWithOptions exposing (..)++import CommentDecoder exposing (..)+import Json.Decode exposing (..)+import Json.Decode.Pipeline exposing (..)+import PostType exposing (..)+++decodePost : Decoder Post+decodePost =+    decode Post+        |> required "postId" int+        |> required "postName" string+        |> required "postAge" (maybe float)+        |> required "postComments" (list decodeComment)+        |> required "postPromoted" (maybe decodeComment)+        |> required "postAuthor" (maybe string)
+ test/PostEncoder.elm view
@@ -0,0 +1,17 @@+module PostEncoder exposing (..)++import CommentEncoder exposing (..)+import Json.Encode exposing (..)+import PostType exposing (..)+++encodePost : Post -> Value+encodePost x =+    object+        [ ( "id", int x.id )+        , ( "name", string x.name )+        , ( "age", (Maybe.withDefault null << Maybe.map float) x.age )+        , ( "comments", (list << List.map encodeComment) x.comments )+        , ( "promoted", (Maybe.withDefault null << Maybe.map encodeComment) x.promoted )+        , ( "author", (Maybe.withDefault null << Maybe.map string) x.author )+        ]
+ test/PostEncoderWithOptions.elm view
@@ -0,0 +1,17 @@+module PostEncoderWithOptions exposing (..)++import CommentEncoder exposing (..)+import Json.Encode exposing (..)+import PostType exposing (..)+++encodePost : Post -> Value+encodePost x =+    object+        [ ( "postId", int x.id )+        , ( "postName", string x.name )+        , ( "postAge", (Maybe.withDefault null << Maybe.map float) x.age )+        , ( "postComments", (list << List.map encodeComment) x.comments )+        , ( "postPromoted", (Maybe.withDefault null << Maybe.map encodeComment) x.promoted )+        , ( "postAuthor", (Maybe.withDefault null << Maybe.map string) x.author )+        ]
+ test/PostType.elm view
@@ -0,0 +1,13 @@+module PostType exposing (..)++import CommentType exposing (..)+++type alias Post =+    { id : Int+    , name : String+    , age : Maybe Float+    , comments : List Comment+    , promoted : Maybe Comment+    , author : Maybe String+    }
+ test/PostTypeWithOptions.elm view
@@ -0,0 +1,13 @@+module PostTypeWithOptions exposing (..)++import CommentType exposing (..)+++type alias Post =+    { postId : Int+    , postName : String+    , postAge : Maybe Float+    , postComments : List Comment+    , postPromoted : Maybe Comment+    , postAuthor : Maybe String+    }