################################################################################ Codegen.Either: ################################################################################ module Codegen.Either exposing (..) import Json.Encode import Json.Encode exposing (Value) import Json.Decode import Json.Decode exposing (Decoder) import Json.Decode.Extra exposing (andMap) type Either a0 a1 = Left a0 | Right a1 encodeEither : (e0 -> Value) -> (e1 -> Value) -> (Either e0 e1) -> Value encodeEither e0 e1 v = case v of Left p0 -> Json.Encode.object [ ( "tag", Json.Encode.string "Left" ) , ( "contents" , e0 p0 ) ] Right p0 -> Json.Encode.object [ ( "tag", Json.Encode.string "Right" ) , ( "contents" , e1 p0 ) ] decodeEither : Decoder a0 -> Decoder a1 -> Decoder (Either a0 a1) decodeEither d0 d1 = let decide : String -> Decoder (Either a0 a1) decide tag = case tag of "Left" -> Json.Decode.field "contents" <| Json.Decode.map Left d0 "Right" -> Json.Decode.field "contents" <| Json.Decode.map Right d1 other -> Json.Decode.fail <| "(Either a0 a1) doesn't have constructor: " ++ other in Json.Decode.field "tag" Json.Decode.string |> Json.Decode.andThen decide ################################################################################ ################################################################################ Codegen.Report: ################################################################################ module Codegen.Report exposing (..) import Json.Decode import Json.Encode import Json.Encode.Extra import Maybe import Json.Encode import Json.Encode exposing (Value) import Json.Decode import Json.Decode exposing (Decoder) import Json.Decode.Extra exposing (andMap) type Form = Form { userName : (Maybe.Maybe String) , upload : (Maybe.Maybe FileUpload) } type FileUpload = FileUpload { fileName : (Maybe.Maybe String) } encodeForm : Form -> Value encodeForm v = case v of Form r -> Json.Encode.object [ ("userName", (Json.Encode.Extra.maybe (Json.Encode.string)) r.userName) , ("upload", (Json.Encode.Extra.maybe (encodeFileUpload)) r.upload) ] encodeFileUpload : FileUpload -> Value encodeFileUpload v = case v of FileUpload r -> Json.Encode.object [ ("fileName", (Json.Encode.Extra.maybe (Json.Encode.string)) r.fileName) ] decodeForm : Decoder Form decodeForm = let mkFunction = \userName upload -> { userName = userName , upload = upload } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "userName" (Json.Decode.nullable Json.Decode.string)) |> andMap (Json.Decode.field "upload" (Json.Decode.nullable decodeFileUpload)) in Json.Decode.field "contents" (Json.Decode.map Form contentDecoder) decodeFileUpload : Decoder FileUpload decodeFileUpload = let mkFunction = \fileName -> { fileName = fileName } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "fileName" (Json.Decode.nullable Json.Decode.string)) in Json.Decode.field "contents" (Json.Decode.map FileUpload contentDecoder) ################################################################################ ################################################################################ Codegen.SampleTypes: ################################################################################ module Codegen.SampleTypes exposing (..) import Codegen.Either import Json.Decode import Json.Encode import Json.Encode.Extra import Maybe import Json.Encode import Json.Encode exposing (Value) import Json.Decode import Json.Decode exposing (Decoder) import Json.Decode.Extra exposing (andMap) type LargeRecord a0 = LargeRecord { field0 : (LookMaNoPhantomParam a0) , field1 : (LookMaNoPhantomParam a0) , field2 : (LookMaNoPhantomParam a0) , field3 : (LookMaNoPhantomParam a0) , field4 : (LookMaNoPhantomParam a0) , field5 : (LookMaNoPhantomParam a0) , field6 : (LookMaNoPhantomParam a0) , field7 : (LookMaNoPhantomParam a0) , field8 : (LookMaNoPhantomParam a0) , field9 : (LookMaNoPhantomParam a0) , field10 : (LookMaNoPhantomParam a0) , field11 : (LookMaNoPhantomParam a0) , field12 : (LookMaNoPhantomParam a0) , field13 : (LookMaNoPhantomParam a0) , field14 : (LookMaNoPhantomParam a0) , field15 : (LookMaNoPhantomParam a0) , field16 : (LookMaNoPhantomParam a0) , field17 : (LookMaNoPhantomParam a0) , field18 : (LookMaNoPhantomParam a0) , field19 : (LookMaNoPhantomParam a0) , field20 : (LookMaNoPhantomParam a0) , field21 : (LookMaNoPhantomParam a0) , field22 : (LookMaNoPhantomParam a0) , field23 : (LookMaNoPhantomParam a0) , field24 : (LookMaNoPhantomParam a0) , field25 : (LookMaNoPhantomParam a0) , field26 : (LookMaNoPhantomParam a0) , field27 : (LookMaNoPhantomParam a0) , field28 : (LookMaNoPhantomParam a0) , field29 : (LookMaNoPhantomParam a0) , field30 : (LookMaNoPhantomParam a0) , field31 : (LookMaNoPhantomParam a0) , field32 : (LookMaNoPhantomParam a0) , field33 : (LookMaNoPhantomParam a0) , field34 : (LookMaNoPhantomParam a0) , field35 : (LookMaNoPhantomParam a0) , field36 : (LookMaNoPhantomParam a0) , field37 : (LookMaNoPhantomParam a0) , field38 : (LookMaNoPhantomParam a0) , field39 : (LookMaNoPhantomParam a0) , field40 : (LookMaNoPhantomParam a0) , field41 : (LookMaNoPhantomParam a0) , field42 : (LookMaNoPhantomParam a0) , field43 : (LookMaNoPhantomParam a0) , field44 : (LookMaNoPhantomParam a0) , field45 : (LookMaNoPhantomParam a0) , field46 : (LookMaNoPhantomParam a0) , field47 : (LookMaNoPhantomParam a0) , field48 : (LookMaNoPhantomParam a0) , field49 : (LookMaNoPhantomParam a0) , field50 : (LookMaNoPhantomParam a0) , field51 : (LookMaNoPhantomParam a0) , field52 : (LookMaNoPhantomParam a0) , field53 : (LookMaNoPhantomParam a0) , field54 : (LookMaNoPhantomParam a0) , field55 : (LookMaNoPhantomParam a0) , field56 : (LookMaNoPhantomParam a0) , field57 : (LookMaNoPhantomParam a0) , field58 : (LookMaNoPhantomParam a0) , field59 : (LookMaNoPhantomParam a0) , field60 : (LookMaNoPhantomParam a0) , field61 : (LookMaNoPhantomParam a0) , field62 : (LookMaNoPhantomParam a0) , field63 : (LookMaNoPhantomParam a0) , field64 : (LookMaNoPhantomParam a0) , field65 : (LookMaNoPhantomParam a0) , field66 : (LookMaNoPhantomParam a0) , field67 : (LookMaNoPhantomParam a0) , field68 : (LookMaNoPhantomParam a0) , field69 : (LookMaNoPhantomParam a0) , field70 : (LookMaNoPhantomParam a0) , field71 : (LookMaNoPhantomParam a0) , field72 : (LookMaNoPhantomParam a0) , field73 : (LookMaNoPhantomParam a0) , field74 : (LookMaNoPhantomParam a0) , field75 : (LookMaNoPhantomParam a0) , field76 : (LookMaNoPhantomParam a0) , field77 : (LookMaNoPhantomParam a0) , field78 : (LookMaNoPhantomParam a0) , field79 : (LookMaNoPhantomParam a0) , field80 : (LookMaNoPhantomParam a0) , field81 : (LookMaNoPhantomParam a0) , field82 : (LookMaNoPhantomParam a0) , field83 : (LookMaNoPhantomParam a0) , field84 : (LookMaNoPhantomParam a0) , field85 : (LookMaNoPhantomParam a0) , field86 : (LookMaNoPhantomParam a0) , field87 : (LookMaNoPhantomParam a0) , field88 : (LookMaNoPhantomParam a0) , field89 : (LookMaNoPhantomParam a0) , field90 : (LookMaNoPhantomParam a0) , field91 : (LookMaNoPhantomParam a0) , field92 : (LookMaNoPhantomParam a0) , field93 : (LookMaNoPhantomParam a0) , field94 : (LookMaNoPhantomParam a0) , field95 : (LookMaNoPhantomParam a0) , field96 : (LookMaNoPhantomParam a0) , field97 : (LookMaNoPhantomParam a0) , field98 : (LookMaNoPhantomParam a0) , field99 : (LookMaNoPhantomParam a0) } type RecordWithMultipleConstructors = FirstRecordConstructor { foo : Bool } | SecondRecordConstructor { bar : (Maybe.Maybe Int) } type LookMaNoPhantomParam a0 = NatPhantomParameter (List a0) type HKTWithUnspecializedParams a0 a1 = HKTWithUnspecializedParams (Codegen.Either.Either Int (Codegen.Either.Either Int (Codegen.Either.Either Int a0))) a1 type HKTWithSpecializedKindStarParams = HKTWithSpecializedKindStarParams String (Maybe.Maybe Int) type SimpleHKTMaybe = SimpleHKT (Maybe.Maybe String) type PolymorphicRecursiveType a0 = SPRTNil | SPRTCons a0 (PolymorphicRecursiveType a0) type MonomorphicRecursiveType = SMRTNil | SMRTCons Int MonomorphicRecursiveType type alias EmptyAlias = {} type alias SimpleRecordAlias = { name : (PolymorphicRecursiveType SimpleType) , age : SimpleType } type SimpleRecord = SimpleRecord { name : (PolymorphicRecursiveType SimpleType) , age : SimpleType } type SimpleType = SimpleType Int encodeLargeRecord : (e0 -> Value) -> (LargeRecord e0) -> Value encodeLargeRecord e0 v = case v of LargeRecord r -> Json.Encode.object [ ("field0", (encodeNatPhantomParameter e0) r.field0) , ("field1", (encodeNatPhantomParameter e0) r.field1) , ("field2", (encodeNatPhantomParameter e0) r.field2) , ("field3", (encodeNatPhantomParameter e0) r.field3) , ("field4", (encodeNatPhantomParameter e0) r.field4) , ("field5", (encodeNatPhantomParameter e0) r.field5) , ("field6", (encodeNatPhantomParameter e0) r.field6) , ("field7", (encodeNatPhantomParameter e0) r.field7) , ("field8", (encodeNatPhantomParameter e0) r.field8) , ("field9", (encodeNatPhantomParameter e0) r.field9) , ("field10", (encodeNatPhantomParameter e0) r.field10) , ("field11", (encodeNatPhantomParameter e0) r.field11) , ("field12", (encodeNatPhantomParameter e0) r.field12) , ("field13", (encodeNatPhantomParameter e0) r.field13) , ("field14", (encodeNatPhantomParameter e0) r.field14) , ("field15", (encodeNatPhantomParameter e0) r.field15) , ("field16", (encodeNatPhantomParameter e0) r.field16) , ("field17", (encodeNatPhantomParameter e0) r.field17) , ("field18", (encodeNatPhantomParameter e0) r.field18) , ("field19", (encodeNatPhantomParameter e0) r.field19) , ("field20", (encodeNatPhantomParameter e0) r.field20) , ("field21", (encodeNatPhantomParameter e0) r.field21) , ("field22", (encodeNatPhantomParameter e0) r.field22) , ("field23", (encodeNatPhantomParameter e0) r.field23) , ("field24", (encodeNatPhantomParameter e0) r.field24) , ("field25", (encodeNatPhantomParameter e0) r.field25) , ("field26", (encodeNatPhantomParameter e0) r.field26) , ("field27", (encodeNatPhantomParameter e0) r.field27) , ("field28", (encodeNatPhantomParameter e0) r.field28) , ("field29", (encodeNatPhantomParameter e0) r.field29) , ("field30", (encodeNatPhantomParameter e0) r.field30) , ("field31", (encodeNatPhantomParameter e0) r.field31) , ("field32", (encodeNatPhantomParameter e0) r.field32) , ("field33", (encodeNatPhantomParameter e0) r.field33) , ("field34", (encodeNatPhantomParameter e0) r.field34) , ("field35", (encodeNatPhantomParameter e0) r.field35) , ("field36", (encodeNatPhantomParameter e0) r.field36) , ("field37", (encodeNatPhantomParameter e0) r.field37) , ("field38", (encodeNatPhantomParameter e0) r.field38) , ("field39", (encodeNatPhantomParameter e0) r.field39) , ("field40", (encodeNatPhantomParameter e0) r.field40) , ("field41", (encodeNatPhantomParameter e0) r.field41) , ("field42", (encodeNatPhantomParameter e0) r.field42) , ("field43", (encodeNatPhantomParameter e0) r.field43) , ("field44", (encodeNatPhantomParameter e0) r.field44) , ("field45", (encodeNatPhantomParameter e0) r.field45) , ("field46", (encodeNatPhantomParameter e0) r.field46) , ("field47", (encodeNatPhantomParameter e0) r.field47) , ("field48", (encodeNatPhantomParameter e0) r.field48) , ("field49", (encodeNatPhantomParameter e0) r.field49) , ("field50", (encodeNatPhantomParameter e0) r.field50) , ("field51", (encodeNatPhantomParameter e0) r.field51) , ("field52", (encodeNatPhantomParameter e0) r.field52) , ("field53", (encodeNatPhantomParameter e0) r.field53) , ("field54", (encodeNatPhantomParameter e0) r.field54) , ("field55", (encodeNatPhantomParameter e0) r.field55) , ("field56", (encodeNatPhantomParameter e0) r.field56) , ("field57", (encodeNatPhantomParameter e0) r.field57) , ("field58", (encodeNatPhantomParameter e0) r.field58) , ("field59", (encodeNatPhantomParameter e0) r.field59) , ("field60", (encodeNatPhantomParameter e0) r.field60) , ("field61", (encodeNatPhantomParameter e0) r.field61) , ("field62", (encodeNatPhantomParameter e0) r.field62) , ("field63", (encodeNatPhantomParameter e0) r.field63) , ("field64", (encodeNatPhantomParameter e0) r.field64) , ("field65", (encodeNatPhantomParameter e0) r.field65) , ("field66", (encodeNatPhantomParameter e0) r.field66) , ("field67", (encodeNatPhantomParameter e0) r.field67) , ("field68", (encodeNatPhantomParameter e0) r.field68) , ("field69", (encodeNatPhantomParameter e0) r.field69) , ("field70", (encodeNatPhantomParameter e0) r.field70) , ("field71", (encodeNatPhantomParameter e0) r.field71) , ("field72", (encodeNatPhantomParameter e0) r.field72) , ("field73", (encodeNatPhantomParameter e0) r.field73) , ("field74", (encodeNatPhantomParameter e0) r.field74) , ("field75", (encodeNatPhantomParameter e0) r.field75) , ("field76", (encodeNatPhantomParameter e0) r.field76) , ("field77", (encodeNatPhantomParameter e0) r.field77) , ("field78", (encodeNatPhantomParameter e0) r.field78) , ("field79", (encodeNatPhantomParameter e0) r.field79) , ("field80", (encodeNatPhantomParameter e0) r.field80) , ("field81", (encodeNatPhantomParameter e0) r.field81) , ("field82", (encodeNatPhantomParameter e0) r.field82) , ("field83", (encodeNatPhantomParameter e0) r.field83) , ("field84", (encodeNatPhantomParameter e0) r.field84) , ("field85", (encodeNatPhantomParameter e0) r.field85) , ("field86", (encodeNatPhantomParameter e0) r.field86) , ("field87", (encodeNatPhantomParameter e0) r.field87) , ("field88", (encodeNatPhantomParameter e0) r.field88) , ("field89", (encodeNatPhantomParameter e0) r.field89) , ("field90", (encodeNatPhantomParameter e0) r.field90) , ("field91", (encodeNatPhantomParameter e0) r.field91) , ("field92", (encodeNatPhantomParameter e0) r.field92) , ("field93", (encodeNatPhantomParameter e0) r.field93) , ("field94", (encodeNatPhantomParameter e0) r.field94) , ("field95", (encodeNatPhantomParameter e0) r.field95) , ("field96", (encodeNatPhantomParameter e0) r.field96) , ("field97", (encodeNatPhantomParameter e0) r.field97) , ("field98", (encodeNatPhantomParameter e0) r.field98) , ("field99", (encodeNatPhantomParameter e0) r.field99) ] encodeRecordWithMultipleConstructors : RecordWithMultipleConstructors -> Value encodeRecordWithMultipleConstructors v = case v of FirstRecordConstructor r -> Json.Encode.object [ ( "tag", Json.Encode.string "FirstRecordConstructor" ) , ( "contents" , Json.Encode.object [ ("foo", (Json.Encode.bool) r.foo) ] ) ] SecondRecordConstructor r -> Json.Encode.object [ ( "tag", Json.Encode.string "SecondRecordConstructor" ) , ( "contents" , Json.Encode.object [ ("bar", (Json.Encode.Extra.maybe (Json.Encode.int)) r.bar) ] ) ] encodeNatPhantomParameter : (e0 -> Value) -> (LookMaNoPhantomParam e0) -> Value encodeNatPhantomParameter e0 v = case v of NatPhantomParameter p0 -> (Json.Encode.list e0) p0 encodeHKTWithUnspecializedParams : (e0 -> Value) -> (e1 -> Value) -> (HKTWithUnspecializedParams e0 e1) -> Value encodeHKTWithUnspecializedParams e0 e1 v = case v of HKTWithUnspecializedParams p0 p1 -> Json.Encode.list identity [ (Codegen.Either.encodeEither (Json.Encode.int) (Codegen.Either.encodeEither (Json.Encode.int) (Codegen.Either.encodeEither (Json.Encode.int) e0))) p0 , e1 p1 ] encodeHKTWithSpecializedKindStarParams : HKTWithSpecializedKindStarParams -> Value encodeHKTWithSpecializedKindStarParams v = case v of HKTWithSpecializedKindStarParams p0 p1 -> Json.Encode.list identity [ (Json.Encode.string) p0 , (Json.Encode.Extra.maybe (Json.Encode.int)) p1 ] encodeSimpleHKT : SimpleHKTMaybe -> Value encodeSimpleHKT v = case v of SimpleHKT p0 -> (Json.Encode.Extra.maybe (Json.Encode.string)) p0 encodePolymorphicRecursiveType : (e0 -> Value) -> (PolymorphicRecursiveType e0) -> Value encodePolymorphicRecursiveType e0 v = case v of SPRTNil -> Json.Encode.object [ ( "tag", Json.Encode.string "SPRTNil" )] SPRTCons p0 p1 -> Json.Encode.object [ ( "tag", Json.Encode.string "SPRTCons" ) , ( "contents" , Json.Encode.list identity [ e0 p0 , (encodePolymorphicRecursiveType e0) p1 ] ) ] encodeMonomorphicRecursiveType : MonomorphicRecursiveType -> Value encodeMonomorphicRecursiveType v = case v of SMRTNil -> Json.Encode.object [ ( "tag", Json.Encode.string "SMRTNil" )] SMRTCons p0 p1 -> Json.Encode.object [ ( "tag", Json.Encode.string "SMRTCons" ) , ( "contents" , Json.Encode.list identity [ (Json.Encode.int) p0 , (encodeMonomorphicRecursiveType) p1 ] ) ] encodeEmptyAlias : EmptyAlias -> Value encodeEmptyAlias r = Json.Encode.list identity [] encodeSimpleRecordAlias : SimpleRecordAlias -> Value encodeSimpleRecordAlias r = Json.Encode.object [ ("name", (encodePolymorphicRecursiveType (encodeSimpleType)) r.name) , ("age", (encodeSimpleType) r.age) ] encodeSimpleRecord : SimpleRecord -> Value encodeSimpleRecord v = case v of SimpleRecord r -> Json.Encode.object [ ("name", (encodePolymorphicRecursiveType (encodeSimpleType)) r.name) , ("age", (encodeSimpleType) r.age) ] encodeSimpleType : SimpleType -> Value encodeSimpleType v = case v of SimpleType p0 -> (Json.Encode.int) p0 decodeLargeRecord : Decoder a0 -> Decoder (LargeRecord a0) decodeLargeRecord d0 = let mkFunction = \field0 field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 field11 field12 field13 field14 field15 field16 field17 field18 field19 field20 field21 field22 field23 field24 field25 field26 field27 field28 field29 field30 field31 field32 field33 field34 field35 field36 field37 field38 field39 field40 field41 field42 field43 field44 field45 field46 field47 field48 field49 field50 field51 field52 field53 field54 field55 field56 field57 field58 field59 field60 field61 field62 field63 field64 field65 field66 field67 field68 field69 field70 field71 field72 field73 field74 field75 field76 field77 field78 field79 field80 field81 field82 field83 field84 field85 field86 field87 field88 field89 field90 field91 field92 field93 field94 field95 field96 field97 field98 field99 -> { field0 = field0 , field1 = field1 , field2 = field2 , field3 = field3 , field4 = field4 , field5 = field5 , field6 = field6 , field7 = field7 , field8 = field8 , field9 = field9 , field10 = field10 , field11 = field11 , field12 = field12 , field13 = field13 , field14 = field14 , field15 = field15 , field16 = field16 , field17 = field17 , field18 = field18 , field19 = field19 , field20 = field20 , field21 = field21 , field22 = field22 , field23 = field23 , field24 = field24 , field25 = field25 , field26 = field26 , field27 = field27 , field28 = field28 , field29 = field29 , field30 = field30 , field31 = field31 , field32 = field32 , field33 = field33 , field34 = field34 , field35 = field35 , field36 = field36 , field37 = field37 , field38 = field38 , field39 = field39 , field40 = field40 , field41 = field41 , field42 = field42 , field43 = field43 , field44 = field44 , field45 = field45 , field46 = field46 , field47 = field47 , field48 = field48 , field49 = field49 , field50 = field50 , field51 = field51 , field52 = field52 , field53 = field53 , field54 = field54 , field55 = field55 , field56 = field56 , field57 = field57 , field58 = field58 , field59 = field59 , field60 = field60 , field61 = field61 , field62 = field62 , field63 = field63 , field64 = field64 , field65 = field65 , field66 = field66 , field67 = field67 , field68 = field68 , field69 = field69 , field70 = field70 , field71 = field71 , field72 = field72 , field73 = field73 , field74 = field74 , field75 = field75 , field76 = field76 , field77 = field77 , field78 = field78 , field79 = field79 , field80 = field80 , field81 = field81 , field82 = field82 , field83 = field83 , field84 = field84 , field85 = field85 , field86 = field86 , field87 = field87 , field88 = field88 , field89 = field89 , field90 = field90 , field91 = field91 , field92 = field92 , field93 = field93 , field94 = field94 , field95 = field95 , field96 = field96 , field97 = field97 , field98 = field98 , field99 = field99 } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "field0" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field1" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field2" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field3" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field4" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field5" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field6" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field7" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field8" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field9" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field10" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field11" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field12" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field13" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field14" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field15" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field16" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field17" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field18" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field19" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field20" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field21" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field22" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field23" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field24" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field25" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field26" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field27" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field28" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field29" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field30" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field31" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field32" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field33" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field34" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field35" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field36" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field37" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field38" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field39" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field40" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field41" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field42" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field43" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field44" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field45" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field46" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field47" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field48" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field49" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field50" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field51" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field52" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field53" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field54" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field55" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field56" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field57" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field58" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field59" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field60" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field61" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field62" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field63" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field64" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field65" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field66" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field67" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field68" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field69" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field70" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field71" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field72" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field73" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field74" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field75" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field76" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field77" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field78" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field79" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field80" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field81" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field82" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field83" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field84" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field85" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field86" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field87" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field88" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field89" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field90" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field91" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field92" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field93" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field94" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field95" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field96" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field97" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field98" (decodeNatPhantomParameter d0)) |> andMap (Json.Decode.field "field99" (decodeNatPhantomParameter d0)) in Json.Decode.field "contents" (Json.Decode.map LargeRecord contentDecoder) decodeRecordWithMultipleConstructors : Decoder RecordWithMultipleConstructors decodeRecordWithMultipleConstructors = let decide : String -> Decoder RecordWithMultipleConstructors decide tag = case tag of "FirstRecordConstructor" -> let mkFunction = \foo -> { foo = foo } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "foo" Json.Decode.bool) in Json.Decode.field "contents" (Json.Decode.map FirstRecordConstructor contentDecoder) "SecondRecordConstructor" -> let mkFunction = \bar -> { bar = bar } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "bar" (Json.Decode.nullable Json.Decode.int)) in Json.Decode.field "contents" (Json.Decode.map SecondRecordConstructor contentDecoder) other -> Json.Decode.fail <| "RecordWithMultipleConstructors doesn't have constructor: " ++ other in Json.Decode.field "tag" Json.Decode.string |> Json.Decode.andThen decide decodeNatPhantomParameter : Decoder a0 -> Decoder (LookMaNoPhantomParam a0) decodeNatPhantomParameter d0 = Json.Decode.field "contents" <| Json.Decode.map NatPhantomParameter (Json.Decode.list d0) decodeHKTWithUnspecializedParams : Decoder a0 -> Decoder a1 -> Decoder (HKTWithUnspecializedParams a0 a1) decodeHKTWithUnspecializedParams d0 d1 = let contentDecoder = Json.Decode.succeed HKTWithUnspecializedParams |> andMap (Json.Decode.index 0 (Codegen.Either.decodeEither Json.Decode.int (Codegen.Either.decodeEither Json.Decode.int (Codegen.Either.decodeEither Json.Decode.int d0)))) |> andMap (Json.Decode.index 1 d1) in Json.Decode.field "contents" contentDecoder decodeHKTWithSpecializedKindStarParams : Decoder HKTWithSpecializedKindStarParams decodeHKTWithSpecializedKindStarParams = let contentDecoder = Json.Decode.succeed HKTWithSpecializedKindStarParams |> andMap (Json.Decode.index 0 Json.Decode.string) |> andMap (Json.Decode.index 1 (Json.Decode.nullable Json.Decode.int)) in Json.Decode.field "contents" contentDecoder decodeSimpleHKT : Decoder SimpleHKTMaybe decodeSimpleHKT = Json.Decode.field "contents" <| Json.Decode.map SimpleHKT (Json.Decode.nullable Json.Decode.string) decodePolymorphicRecursiveType : Decoder a0 -> Decoder (PolymorphicRecursiveType a0) decodePolymorphicRecursiveType d0 = let decide : String -> Decoder (PolymorphicRecursiveType a0) decide tag = case tag of "SPRTNil" -> Json.Decode.succeed SPRTNil "SPRTCons" -> let contentDecoder = Json.Decode.succeed SPRTCons |> andMap (Json.Decode.index 0 d0) |> andMap (Json.Decode.index 1 (Json.Decode.lazy (\_ -> decodePolymorphicRecursiveType d0))) in Json.Decode.field "contents" contentDecoder other -> Json.Decode.fail <| "(PolymorphicRecursiveType a0) doesn't have constructor: " ++ other in Json.Decode.field "tag" Json.Decode.string |> Json.Decode.andThen decide decodeMonomorphicRecursiveType : Decoder MonomorphicRecursiveType decodeMonomorphicRecursiveType = let decide : String -> Decoder MonomorphicRecursiveType decide tag = case tag of "SMRTNil" -> Json.Decode.succeed SMRTNil "SMRTCons" -> let contentDecoder = Json.Decode.succeed SMRTCons |> andMap (Json.Decode.index 0 Json.Decode.int) |> andMap (Json.Decode.index 1 (Json.Decode.lazy (\_ -> decodeMonomorphicRecursiveType ))) in Json.Decode.field "contents" contentDecoder other -> Json.Decode.fail <| "MonomorphicRecursiveType doesn't have constructor: " ++ other in Json.Decode.field "tag" Json.Decode.string |> Json.Decode.andThen decide decodeEmptyAlias : Decoder EmptyAlias decodeEmptyAlias = Json.Decode.succeed {} decodeSimpleRecordAlias : Decoder SimpleRecordAlias decodeSimpleRecordAlias = let mkFunction = \name age -> { name = name , age = age } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "name" (decodePolymorphicRecursiveType decodeSimpleType)) |> andMap (Json.Decode.field "age" decodeSimpleType) in contentDecoder decodeSimpleRecord : Decoder SimpleRecord decodeSimpleRecord = let mkFunction = \name age -> { name = name , age = age } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "name" (decodePolymorphicRecursiveType decodeSimpleType)) |> andMap (Json.Decode.field "age" decodeSimpleType) in Json.Decode.field "contents" (Json.Decode.map SimpleRecord contentDecoder) decodeSimpleType : Decoder SimpleType decodeSimpleType = Json.Decode.field "contents" <| Json.Decode.map SimpleType Json.Decode.int ################################################################################ ################################################################################ Codegen.Submission: ################################################################################ module Codegen.Submission exposing (..) import Json.Decode import Json.Encode import Json.Encode.Extra import Maybe import Json.Encode import Json.Encode exposing (Value) import Json.Decode import Json.Decode exposing (Decoder) import Json.Decode.Extra exposing (andMap) type Form = Form { userName : String , upload : (Maybe.Maybe FileUpload) } type FileUpload = FileUpload { fileName : String } encodeForm : Form -> Value encodeForm v = case v of Form r -> Json.Encode.object [ ("userName", (Json.Encode.string) r.userName) , ("upload", (Json.Encode.Extra.maybe (encodeFileUpload)) r.upload) ] encodeFileUpload : FileUpload -> Value encodeFileUpload v = case v of FileUpload r -> Json.Encode.object [ ("fileName", (Json.Encode.string) r.fileName) ] decodeForm : Decoder Form decodeForm = let mkFunction = \userName upload -> { userName = userName , upload = upload } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "userName" Json.Decode.string) |> andMap (Json.Decode.field "upload" (Json.Decode.nullable decodeFileUpload)) in Json.Decode.field "contents" (Json.Decode.map Form contentDecoder) decodeFileUpload : Decoder FileUpload decodeFileUpload = let mkFunction = \fileName -> { fileName = fileName } contentDecoder = Json.Decode.succeed mkFunction |> andMap (Json.Decode.field "fileName" Json.Decode.string) in Json.Decode.field "contents" (Json.Decode.map FileUpload contentDecoder) ################################################################################ ################################################################################ Data.CountryCode: ################################################################################ module Data.CountryCode exposing (..) import Json.Encode import Json.Encode exposing (Value) import Json.Decode import Json.Decode exposing (Decoder) import Json.Decode.Extra exposing (andMap) type CountryCode = AD | AE | AF | AG | AI | AL | AM | AO | AQ | AR | AS | AT | AU | AW | AX | AZ | BA | BB | BD | BE | BF | BG | BH | BI | BJ | BL | BM | BN | BO | BQ | BR | BS | BT | BV | BW | BY | BZ | CA | CC | CD | CF | CG | CH | CI | CK | CL | CM | CN | CO | CR | CU | CV | CW | CX | CY | CZ | DE | DJ | DK | DM | DO | DZ | EC | EE | EG | EH | ER | ES | ET | FI | FJ | FK | FM | FO | FR | GA | GB | GD | GE | GF | GG | GH | GI | GL | GM | GN | GP | GQ | GR | GS | GT | GU | GW | GY | HK | HM | HN | HR | HT | HU | ID | IE | IL | IM | IN | IO | IQ | IR | IS | IT | JE | JM | JO | JP | KE | KG | KH | KI | KM | KN | KP | KR | KW | KY | KZ | LA | LB | LC | LI | LK | LR | LS | LT | LU | LV | LY | MA | MC | MD | ME | MF | MG | MH | MK | ML | MM | MN | MO | MP | MQ | MR | MS | MT | MU | MV | MW | MX | MY | MZ | NA | NC | NE | NF | NG | NI | NL | NO | NP | NR | NU | NZ | OM | PA | PE | PF | PG | PH | PK | PL | PM | PN | PR | PS | PT | PW | PY | QA | RE | RO | RS | RU | RW | SA | SB | SC | SD | SE | SG | SH | SI | SJ | SK | SL | SM | SN | SO | SR | SS | ST | SV | SX | SY | SZ | TC | TD | TF | TG | TH | TJ | TK | TL | TM | TN | TO | TR | TT | TV | TW | TZ | UA | UG | UM | US | UY | UZ | VA | VC | VE | VG | VI | VN | VU | WF | WS | YE | YT | ZA | ZM | ZW encodeCountryCode : CountryCode -> Value encodeCountryCode v = case v of AD -> Json.Encode.string "AD" AE -> Json.Encode.string "AE" AF -> Json.Encode.string "AF" AG -> Json.Encode.string "AG" AI -> Json.Encode.string "AI" AL -> Json.Encode.string "AL" AM -> Json.Encode.string "AM" AO -> Json.Encode.string "AO" AQ -> Json.Encode.string "AQ" AR -> Json.Encode.string "AR" AS -> Json.Encode.string "AS" AT -> Json.Encode.string "AT" AU -> Json.Encode.string "AU" AW -> Json.Encode.string "AW" AX -> Json.Encode.string "AX" AZ -> Json.Encode.string "AZ" BA -> Json.Encode.string "BA" BB -> Json.Encode.string "BB" BD -> Json.Encode.string "BD" BE -> Json.Encode.string "BE" BF -> Json.Encode.string "BF" BG -> Json.Encode.string "BG" BH -> Json.Encode.string "BH" BI -> Json.Encode.string "BI" BJ -> Json.Encode.string "BJ" BL -> Json.Encode.string "BL" BM -> Json.Encode.string "BM" BN -> Json.Encode.string "BN" BO -> Json.Encode.string "BO" BQ -> Json.Encode.string "BQ" BR -> Json.Encode.string "BR" BS -> Json.Encode.string "BS" BT -> Json.Encode.string "BT" BV -> Json.Encode.string "BV" BW -> Json.Encode.string "BW" BY -> Json.Encode.string "BY" BZ -> Json.Encode.string "BZ" CA -> Json.Encode.string "CA" CC -> Json.Encode.string "CC" CD -> Json.Encode.string "CD" CF -> Json.Encode.string "CF" CG -> Json.Encode.string "CG" CH -> Json.Encode.string "CH" CI -> Json.Encode.string "CI" CK -> Json.Encode.string "CK" CL -> Json.Encode.string "CL" CM -> Json.Encode.string "CM" CN -> Json.Encode.string "CN" CO -> Json.Encode.string "CO" CR -> Json.Encode.string "CR" CU -> Json.Encode.string "CU" CV -> Json.Encode.string "CV" CW -> Json.Encode.string "CW" CX -> Json.Encode.string "CX" CY -> Json.Encode.string "CY" CZ -> Json.Encode.string "CZ" DE -> Json.Encode.string "DE" DJ -> Json.Encode.string "DJ" DK -> Json.Encode.string "DK" DM -> Json.Encode.string "DM" DO -> Json.Encode.string "DO" DZ -> Json.Encode.string "DZ" EC -> Json.Encode.string "EC" EE -> Json.Encode.string "EE" EG -> Json.Encode.string "EG" EH -> Json.Encode.string "EH" ER -> Json.Encode.string "ER" ES -> Json.Encode.string "ES" ET -> Json.Encode.string "ET" FI -> Json.Encode.string "FI" FJ -> Json.Encode.string "FJ" FK -> Json.Encode.string "FK" FM -> Json.Encode.string "FM" FO -> Json.Encode.string "FO" FR -> Json.Encode.string "FR" GA -> Json.Encode.string "GA" GB -> Json.Encode.string "GB" GD -> Json.Encode.string "GD" GE -> Json.Encode.string "GE" GF -> Json.Encode.string "GF" GG -> Json.Encode.string "GG" GH -> Json.Encode.string "GH" GI -> Json.Encode.string "GI" GL -> Json.Encode.string "GL" GM -> Json.Encode.string "GM" GN -> Json.Encode.string "GN" GP -> Json.Encode.string "GP" GQ -> Json.Encode.string "GQ" GR -> Json.Encode.string "GR" GS -> Json.Encode.string "GS" GT -> Json.Encode.string "GT" GU -> Json.Encode.string "GU" GW -> Json.Encode.string "GW" GY -> Json.Encode.string "GY" HK -> Json.Encode.string "HK" HM -> Json.Encode.string "HM" HN -> Json.Encode.string "HN" HR -> Json.Encode.string "HR" HT -> Json.Encode.string "HT" HU -> Json.Encode.string "HU" ID -> Json.Encode.string "ID" IE -> Json.Encode.string "IE" IL -> Json.Encode.string "IL" IM -> Json.Encode.string "IM" IN -> Json.Encode.string "IN" IO -> Json.Encode.string "IO" IQ -> Json.Encode.string "IQ" IR -> Json.Encode.string "IR" IS -> Json.Encode.string "IS" IT -> Json.Encode.string "IT" JE -> Json.Encode.string "JE" JM -> Json.Encode.string "JM" JO -> Json.Encode.string "JO" JP -> Json.Encode.string "JP" KE -> Json.Encode.string "KE" KG -> Json.Encode.string "KG" KH -> Json.Encode.string "KH" KI -> Json.Encode.string "KI" KM -> Json.Encode.string "KM" KN -> Json.Encode.string "KN" KP -> Json.Encode.string "KP" KR -> Json.Encode.string "KR" KW -> Json.Encode.string "KW" KY -> Json.Encode.string "KY" KZ -> Json.Encode.string "KZ" LA -> Json.Encode.string "LA" LB -> Json.Encode.string "LB" LC -> Json.Encode.string "LC" LI -> Json.Encode.string "LI" LK -> Json.Encode.string "LK" LR -> Json.Encode.string "LR" LS -> Json.Encode.string "LS" LT -> Json.Encode.string "LT" LU -> Json.Encode.string "LU" LV -> Json.Encode.string "LV" LY -> Json.Encode.string "LY" MA -> Json.Encode.string "MA" MC -> Json.Encode.string "MC" MD -> Json.Encode.string "MD" ME -> Json.Encode.string "ME" MF -> Json.Encode.string "MF" MG -> Json.Encode.string "MG" MH -> Json.Encode.string "MH" MK -> Json.Encode.string "MK" ML -> Json.Encode.string "ML" MM -> Json.Encode.string "MM" MN -> Json.Encode.string "MN" MO -> Json.Encode.string "MO" MP -> Json.Encode.string "MP" MQ -> Json.Encode.string "MQ" MR -> Json.Encode.string "MR" MS -> Json.Encode.string "MS" MT -> Json.Encode.string "MT" MU -> Json.Encode.string "MU" MV -> Json.Encode.string "MV" MW -> Json.Encode.string "MW" MX -> Json.Encode.string "MX" MY -> Json.Encode.string "MY" MZ -> Json.Encode.string "MZ" NA -> Json.Encode.string "NA" NC -> Json.Encode.string "NC" NE -> Json.Encode.string "NE" NF -> Json.Encode.string "NF" NG -> Json.Encode.string "NG" NI -> Json.Encode.string "NI" NL -> Json.Encode.string "NL" NO -> Json.Encode.string "NO" NP -> Json.Encode.string "NP" NR -> Json.Encode.string "NR" NU -> Json.Encode.string "NU" NZ -> Json.Encode.string "NZ" OM -> Json.Encode.string "OM" PA -> Json.Encode.string "PA" PE -> Json.Encode.string "PE" PF -> Json.Encode.string "PF" PG -> Json.Encode.string "PG" PH -> Json.Encode.string "PH" PK -> Json.Encode.string "PK" PL -> Json.Encode.string "PL" PM -> Json.Encode.string "PM" PN -> Json.Encode.string "PN" PR -> Json.Encode.string "PR" PS -> Json.Encode.string "PS" PT -> Json.Encode.string "PT" PW -> Json.Encode.string "PW" PY -> Json.Encode.string "PY" QA -> Json.Encode.string "QA" RE -> Json.Encode.string "RE" RO -> Json.Encode.string "RO" RS -> Json.Encode.string "RS" RU -> Json.Encode.string "RU" RW -> Json.Encode.string "RW" SA -> Json.Encode.string "SA" SB -> Json.Encode.string "SB" SC -> Json.Encode.string "SC" SD -> Json.Encode.string "SD" SE -> Json.Encode.string "SE" SG -> Json.Encode.string "SG" SH -> Json.Encode.string "SH" SI -> Json.Encode.string "SI" SJ -> Json.Encode.string "SJ" SK -> Json.Encode.string "SK" SL -> Json.Encode.string "SL" SM -> Json.Encode.string "SM" SN -> Json.Encode.string "SN" SO -> Json.Encode.string "SO" SR -> Json.Encode.string "SR" SS -> Json.Encode.string "SS" ST -> Json.Encode.string "ST" SV -> Json.Encode.string "SV" SX -> Json.Encode.string "SX" SY -> Json.Encode.string "SY" SZ -> Json.Encode.string "SZ" TC -> Json.Encode.string "TC" TD -> Json.Encode.string "TD" TF -> Json.Encode.string "TF" TG -> Json.Encode.string "TG" TH -> Json.Encode.string "TH" TJ -> Json.Encode.string "TJ" TK -> Json.Encode.string "TK" TL -> Json.Encode.string "TL" TM -> Json.Encode.string "TM" TN -> Json.Encode.string "TN" TO -> Json.Encode.string "TO" TR -> Json.Encode.string "TR" TT -> Json.Encode.string "TT" TV -> Json.Encode.string "TV" TW -> Json.Encode.string "TW" TZ -> Json.Encode.string "TZ" UA -> Json.Encode.string "UA" UG -> Json.Encode.string "UG" UM -> Json.Encode.string "UM" US -> Json.Encode.string "US" UY -> Json.Encode.string "UY" UZ -> Json.Encode.string "UZ" VA -> Json.Encode.string "VA" VC -> Json.Encode.string "VC" VE -> Json.Encode.string "VE" VG -> Json.Encode.string "VG" VI -> Json.Encode.string "VI" VN -> Json.Encode.string "VN" VU -> Json.Encode.string "VU" WF -> Json.Encode.string "WF" WS -> Json.Encode.string "WS" YE -> Json.Encode.string "YE" YT -> Json.Encode.string "YT" ZA -> Json.Encode.string "ZA" ZM -> Json.Encode.string "ZM" ZW -> Json.Encode.string "ZW" decodeCountryCode : Decoder CountryCode decodeCountryCode = let decide : String -> Decoder CountryCode decide tag = case tag of "AD" -> Json.Decode.succeed AD "AE" -> Json.Decode.succeed AE "AF" -> Json.Decode.succeed AF "AG" -> Json.Decode.succeed AG "AI" -> Json.Decode.succeed AI "AL" -> Json.Decode.succeed AL "AM" -> Json.Decode.succeed AM "AO" -> Json.Decode.succeed AO "AQ" -> Json.Decode.succeed AQ "AR" -> Json.Decode.succeed AR "AS" -> Json.Decode.succeed AS "AT" -> Json.Decode.succeed AT "AU" -> Json.Decode.succeed AU "AW" -> Json.Decode.succeed AW "AX" -> Json.Decode.succeed AX "AZ" -> Json.Decode.succeed AZ "BA" -> Json.Decode.succeed BA "BB" -> Json.Decode.succeed BB "BD" -> Json.Decode.succeed BD "BE" -> Json.Decode.succeed BE "BF" -> Json.Decode.succeed BF "BG" -> Json.Decode.succeed BG "BH" -> Json.Decode.succeed BH "BI" -> Json.Decode.succeed BI "BJ" -> Json.Decode.succeed BJ "BL" -> Json.Decode.succeed BL "BM" -> Json.Decode.succeed BM "BN" -> Json.Decode.succeed BN "BO" -> Json.Decode.succeed BO "BQ" -> Json.Decode.succeed BQ "BR" -> Json.Decode.succeed BR "BS" -> Json.Decode.succeed BS "BT" -> Json.Decode.succeed BT "BV" -> Json.Decode.succeed BV "BW" -> Json.Decode.succeed BW "BY" -> Json.Decode.succeed BY "BZ" -> Json.Decode.succeed BZ "CA" -> Json.Decode.succeed CA "CC" -> Json.Decode.succeed CC "CD" -> Json.Decode.succeed CD "CF" -> Json.Decode.succeed CF "CG" -> Json.Decode.succeed CG "CH" -> Json.Decode.succeed CH "CI" -> Json.Decode.succeed CI "CK" -> Json.Decode.succeed CK "CL" -> Json.Decode.succeed CL "CM" -> Json.Decode.succeed CM "CN" -> Json.Decode.succeed CN "CO" -> Json.Decode.succeed CO "CR" -> Json.Decode.succeed CR "CU" -> Json.Decode.succeed CU "CV" -> Json.Decode.succeed CV "CW" -> Json.Decode.succeed CW "CX" -> Json.Decode.succeed CX "CY" -> Json.Decode.succeed CY "CZ" -> Json.Decode.succeed CZ "DE" -> Json.Decode.succeed DE "DJ" -> Json.Decode.succeed DJ "DK" -> Json.Decode.succeed DK "DM" -> Json.Decode.succeed DM "DO" -> Json.Decode.succeed DO "DZ" -> Json.Decode.succeed DZ "EC" -> Json.Decode.succeed EC "EE" -> Json.Decode.succeed EE "EG" -> Json.Decode.succeed EG "EH" -> Json.Decode.succeed EH "ER" -> Json.Decode.succeed ER "ES" -> Json.Decode.succeed ES "ET" -> Json.Decode.succeed ET "FI" -> Json.Decode.succeed FI "FJ" -> Json.Decode.succeed FJ "FK" -> Json.Decode.succeed FK "FM" -> Json.Decode.succeed FM "FO" -> Json.Decode.succeed FO "FR" -> Json.Decode.succeed FR "GA" -> Json.Decode.succeed GA "GB" -> Json.Decode.succeed GB "GD" -> Json.Decode.succeed GD "GE" -> Json.Decode.succeed GE "GF" -> Json.Decode.succeed GF "GG" -> Json.Decode.succeed GG "GH" -> Json.Decode.succeed GH "GI" -> Json.Decode.succeed GI "GL" -> Json.Decode.succeed GL "GM" -> Json.Decode.succeed GM "GN" -> Json.Decode.succeed GN "GP" -> Json.Decode.succeed GP "GQ" -> Json.Decode.succeed GQ "GR" -> Json.Decode.succeed GR "GS" -> Json.Decode.succeed GS "GT" -> Json.Decode.succeed GT "GU" -> Json.Decode.succeed GU "GW" -> Json.Decode.succeed GW "GY" -> Json.Decode.succeed GY "HK" -> Json.Decode.succeed HK "HM" -> Json.Decode.succeed HM "HN" -> Json.Decode.succeed HN "HR" -> Json.Decode.succeed HR "HT" -> Json.Decode.succeed HT "HU" -> Json.Decode.succeed HU "ID" -> Json.Decode.succeed ID "IE" -> Json.Decode.succeed IE "IL" -> Json.Decode.succeed IL "IM" -> Json.Decode.succeed IM "IN" -> Json.Decode.succeed IN "IO" -> Json.Decode.succeed IO "IQ" -> Json.Decode.succeed IQ "IR" -> Json.Decode.succeed IR "IS" -> Json.Decode.succeed IS "IT" -> Json.Decode.succeed IT "JE" -> Json.Decode.succeed JE "JM" -> Json.Decode.succeed JM "JO" -> Json.Decode.succeed JO "JP" -> Json.Decode.succeed JP "KE" -> Json.Decode.succeed KE "KG" -> Json.Decode.succeed KG "KH" -> Json.Decode.succeed KH "KI" -> Json.Decode.succeed KI "KM" -> Json.Decode.succeed KM "KN" -> Json.Decode.succeed KN "KP" -> Json.Decode.succeed KP "KR" -> Json.Decode.succeed KR "KW" -> Json.Decode.succeed KW "KY" -> Json.Decode.succeed KY "KZ" -> Json.Decode.succeed KZ "LA" -> Json.Decode.succeed LA "LB" -> Json.Decode.succeed LB "LC" -> Json.Decode.succeed LC "LI" -> Json.Decode.succeed LI "LK" -> Json.Decode.succeed LK "LR" -> Json.Decode.succeed LR "LS" -> Json.Decode.succeed LS "LT" -> Json.Decode.succeed LT "LU" -> Json.Decode.succeed LU "LV" -> Json.Decode.succeed LV "LY" -> Json.Decode.succeed LY "MA" -> Json.Decode.succeed MA "MC" -> Json.Decode.succeed MC "MD" -> Json.Decode.succeed MD "ME" -> Json.Decode.succeed ME "MF" -> Json.Decode.succeed MF "MG" -> Json.Decode.succeed MG "MH" -> Json.Decode.succeed MH "MK" -> Json.Decode.succeed MK "ML" -> Json.Decode.succeed ML "MM" -> Json.Decode.succeed MM "MN" -> Json.Decode.succeed MN "MO" -> Json.Decode.succeed MO "MP" -> Json.Decode.succeed MP "MQ" -> Json.Decode.succeed MQ "MR" -> Json.Decode.succeed MR "MS" -> Json.Decode.succeed MS "MT" -> Json.Decode.succeed MT "MU" -> Json.Decode.succeed MU "MV" -> Json.Decode.succeed MV "MW" -> Json.Decode.succeed MW "MX" -> Json.Decode.succeed MX "MY" -> Json.Decode.succeed MY "MZ" -> Json.Decode.succeed MZ "NA" -> Json.Decode.succeed NA "NC" -> Json.Decode.succeed NC "NE" -> Json.Decode.succeed NE "NF" -> Json.Decode.succeed NF "NG" -> Json.Decode.succeed NG "NI" -> Json.Decode.succeed NI "NL" -> Json.Decode.succeed NL "NO" -> Json.Decode.succeed NO "NP" -> Json.Decode.succeed NP "NR" -> Json.Decode.succeed NR "NU" -> Json.Decode.succeed NU "NZ" -> Json.Decode.succeed NZ "OM" -> Json.Decode.succeed OM "PA" -> Json.Decode.succeed PA "PE" -> Json.Decode.succeed PE "PF" -> Json.Decode.succeed PF "PG" -> Json.Decode.succeed PG "PH" -> Json.Decode.succeed PH "PK" -> Json.Decode.succeed PK "PL" -> Json.Decode.succeed PL "PM" -> Json.Decode.succeed PM "PN" -> Json.Decode.succeed PN "PR" -> Json.Decode.succeed PR "PS" -> Json.Decode.succeed PS "PT" -> Json.Decode.succeed PT "PW" -> Json.Decode.succeed PW "PY" -> Json.Decode.succeed PY "QA" -> Json.Decode.succeed QA "RE" -> Json.Decode.succeed RE "RO" -> Json.Decode.succeed RO "RS" -> Json.Decode.succeed RS "RU" -> Json.Decode.succeed RU "RW" -> Json.Decode.succeed RW "SA" -> Json.Decode.succeed SA "SB" -> Json.Decode.succeed SB "SC" -> Json.Decode.succeed SC "SD" -> Json.Decode.succeed SD "SE" -> Json.Decode.succeed SE "SG" -> Json.Decode.succeed SG "SH" -> Json.Decode.succeed SH "SI" -> Json.Decode.succeed SI "SJ" -> Json.Decode.succeed SJ "SK" -> Json.Decode.succeed SK "SL" -> Json.Decode.succeed SL "SM" -> Json.Decode.succeed SM "SN" -> Json.Decode.succeed SN "SO" -> Json.Decode.succeed SO "SR" -> Json.Decode.succeed SR "SS" -> Json.Decode.succeed SS "ST" -> Json.Decode.succeed ST "SV" -> Json.Decode.succeed SV "SX" -> Json.Decode.succeed SX "SY" -> Json.Decode.succeed SY "SZ" -> Json.Decode.succeed SZ "TC" -> Json.Decode.succeed TC "TD" -> Json.Decode.succeed TD "TF" -> Json.Decode.succeed TF "TG" -> Json.Decode.succeed TG "TH" -> Json.Decode.succeed TH "TJ" -> Json.Decode.succeed TJ "TK" -> Json.Decode.succeed TK "TL" -> Json.Decode.succeed TL "TM" -> Json.Decode.succeed TM "TN" -> Json.Decode.succeed TN "TO" -> Json.Decode.succeed TO "TR" -> Json.Decode.succeed TR "TT" -> Json.Decode.succeed TT "TV" -> Json.Decode.succeed TV "TW" -> Json.Decode.succeed TW "TZ" -> Json.Decode.succeed TZ "UA" -> Json.Decode.succeed UA "UG" -> Json.Decode.succeed UG "UM" -> Json.Decode.succeed UM "US" -> Json.Decode.succeed US "UY" -> Json.Decode.succeed UY "UZ" -> Json.Decode.succeed UZ "VA" -> Json.Decode.succeed VA "VC" -> Json.Decode.succeed VC "VE" -> Json.Decode.succeed VE "VG" -> Json.Decode.succeed VG "VI" -> Json.Decode.succeed VI "VN" -> Json.Decode.succeed VN "VU" -> Json.Decode.succeed VU "WF" -> Json.Decode.succeed WF "WS" -> Json.Decode.succeed WS "YE" -> Json.Decode.succeed YE "YT" -> Json.Decode.succeed YT "ZA" -> Json.Decode.succeed ZA "ZM" -> Json.Decode.succeed ZM "ZW" -> Json.Decode.succeed ZW other -> Json.Decode.fail <| "CountryCode doesn't have constructor: " ++ other in Json.Decode.string |> Json.Decode.andThen decide ################################################################################