packages feed

typed-wire 0.2.1.1 → 0.2.1.2

raw patch · 2 files changed

+7/−4 lines, 2 files

Files

src/TW/CodeGen/Elm.hs view
@@ -48,6 +48,7 @@     , T.intercalate "\n" (map makeImport $ m_imports m)     , ""     , "import TW.Support.Lib as ELib"+    , "import List as L"     , "import Json.Decode as " <> jsonDecQual     , "import Json.Decode exposing ((:=))"     , "import Json.Encode as " <> jsonEncQual@@ -75,8 +76,9 @@     , "   }"     , ""     , "jenc" <> unTypeName (sd_name sd) <> " : " <> encTy <> fullType <> " -> " <> jsonEnc "Value"-    , "jenc" <> unTypeName (sd_name sd) <> " " <> encArgs <> " x ="-    , "    " <> jsonEnc "object"+    , "jenc" <> unTypeName (sd_name sd) <> " = " <> jsonEnc "object" <> " << " <> "jencTuples" <> unTypeName (sd_name sd)+    , "jencTuples" <> unTypeName (sd_name sd) <> " : " <> encTy <> fullType <> " -> List (String, " <> jsonEnc "Value" <> ")"+    , "jencTuples" <> unTypeName (sd_name sd) <> " " <> encArgs <> " x ="     , "    [ " <> T.intercalate "\n    , " (map makeToJsonFld $ sd_fields sd)     , "    ]"     , "jdec" <> unTypeName (sd_name sd) <> " : " <> jsonDec "Decoder" <> " (" <> fullType <> ")"@@ -193,7 +195,8 @@           | bi == tyDate -> "ELib.jencDate"           | bi == tyList ->               case tvars of-                [arg] -> jsonEnc "list" <> " (" <> jsonEncFor arg <> ")"+                [arg] ->+                    "(" <> jsonEnc "list" <> " << L.map (" <> jsonEncFor arg <> "))"                 _ -> error $ "Elm: odly shaped List value"           | bi == tyMaybe ->               case tvars of
typed-wire.cabal view
@@ -1,5 +1,5 @@ name:                typed-wire-version:             0.2.1.1+version:             0.2.1.2 synopsis:            WIP: Language idependent type-safe communication description:         Please see README.md homepage:            http://github.com/agrafix/typed-wire#readme