4[](https://travis-ci.org/agrafix/elm-bridge)
6[](http://packdeps.haskellers.com/reverse/elm-bridge)
10Hackage: [elm-bridge](http://hackage.haskell.org/package/elm-bridge)
12Building the bridge from [Haskell](http://haskell.org) to [Elm](http://elm-lang.org) and back. Define types once, use on both sides and enjoy easy (de)serialisation. Cheers!
14This version of the package only supports Elm 0.19. Version 0.5.2 supports Elm 0.18, and Version 0.3.0.2 supports Elm 0.16 and Elm 0.17.
16Note that the [bartavelle/json-helpers](http://package.elm-lang.org/packages/bartavelle/json-helpers/latest/) package, with version >= 1.2.0, is expected by the generated Elm modules.
21{-# LANGUAGE TemplateHaskell #-}
33deriveBoth defaultOptions ''Foo
37 putStrLn $ makeElmModule "Foo"
38 [ DefineElm (Proxy :: Proxy Foo)
49import Json.Decode exposing ((:=))
51import Json.Helpers exposing (..)
59jsonDecFoo : Json.Decode.Decoder ( Foo )
61 ("f_name" := Json.Decode.string) `Json.Decode.andThen` \pf_name ->
62 ("f_blablub" := Json.Decode.int) `Json.Decode.andThen` \pf_blablub ->
63 Json.Decode.succeed {f_name = pf_name, f_blablub = pf_blablub}
65jsonEncFoo : Foo -> Value
68 [ ("f_name", Json.Encode.string val.f_name)
69 , ("f_blablub", Json.Encode.int val.f_blablub)
73Also, there are functions `Elm.Json.stringSerForSimpleAdt` and `Elm.Json.stringParserForSimpleAdt` to generate functions for your non-JSON ADT types.
75For more usage examples check the tests or the examples dir.
81* Using cabal: `cabal install elm-bridge`
82* From Source: `git clone https://github.com/agrafix/elm-bridge.git && cd elm-bridge && cabal install`
86* `elm package install bartavelle/json-helpers`
90* `elm install bartavelle/json-helpers`
94Pull 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.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list