Created
August 6, 2016 10:42
-
-
Save reactormonk/d24299f1c923a97f41d161bcbcaf6957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Codec exposing (..) | |
import Json.Encode as Encode | |
type alias Listy = { a : List Int, b : Maybe String } | |
encodeListy : Listy -> Encode.Value | |
encodeListy obj = Encode.object | |
[ ("a", Encode.list Encode.int obj.a) | |
, ("b", Maybe.withDefault Encode.null Encode.string obj.b) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment