{"id":16660941,"url":"https://github.com/agrafix/elm-bridge","last_synced_at":"2025-04-09T06:10:42.576Z","repository":{"id":36139365,"uuid":"40443310","full_name":"agrafix/elm-bridge","owner":"agrafix","description":"Haskell: Derive Elm types from Haskell types","archived":false,"fork":false,"pushed_at":"2024-09-26T15:15:17.000Z","size":276,"stargazers_count":104,"open_issues_count":20,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T15:16:07.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agrafix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-09T16:45:59.000Z","updated_at":"2025-02-17T15:22:55.000Z","dependencies_parsed_at":"2024-12-08T13:01:33.902Z","dependency_job_id":null,"html_url":"https://github.com/agrafix/elm-bridge","commit_stats":{"total_commits":152,"total_committers":18,"mean_commits":8.444444444444445,"dds":0.4144736842105263,"last_synced_commit":"57a8a61ec139e4370cb44335ecd8c27cb1a94556"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Felm-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Felm-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Felm-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2Felm-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agrafix","download_url":"https://codeload.github.com/agrafix/elm-bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T10:32:30.675Z","updated_at":"2025-04-09T06:10:42.554Z","avatar_url":"https://github.com/agrafix.png","language":"Elm","funding_links":[],"categories":["Code generators"],"sub_categories":["Individual Podcast episodes"],"readme":"Elm Bridge\n=====\n\n[![Build Status](https://travis-ci.org/agrafix/elm-bridge.svg)](https://travis-ci.org/agrafix/elm-bridge)\n\n[![Hackage Deps](https://img.shields.io/hackage-deps/v/elm-bridge.svg)](http://packdeps.haskellers.com/reverse/elm-bridge)\n\n## Intro\n\nHackage: [elm-bridge](http://hackage.haskell.org/package/elm-bridge)\n\nBuilding 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!\n\nThis 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.\n\nNote that the [bartavelle/json-helpers](http://package.elm-lang.org/packages/bartavelle/json-helpers/latest/) package, with version \u003e= 1.2.0, is expected by the generated Elm modules.\n\n## Usage\n\n```haskell\n{-# LANGUAGE TemplateHaskell #-}\nimport Elm.Derive\nimport Elm.Module\n\nimport Data.Proxy\n\ndata Foo\n   = Foo\n   { f_name :: String\n   , f_blablub :: Int\n   } deriving (Show, Eq)\n\nderiveBoth defaultOptions ''Foo\n\nmain :: IO ()\nmain =\n    putStrLn $ makeElmModule \"Foo\"\n    [ DefineElm (Proxy :: Proxy Foo)\n    ]\n\n```\n\nOutput will be:\n\n```elm\nmodule Foo where\n\nimport Json.Decode\nimport Json.Decode exposing ((:=))\nimport Json.Encode\nimport Json.Helpers exposing (..)\n\n\ntype alias Foo  =\n   { f_name: String\n   , f_blablub: Int\n   }\n\njsonDecFoo : Json.Decode.Decoder ( Foo )\njsonDecFoo =\n   (\"f_name\" := Json.Decode.string) `Json.Decode.andThen` \\pf_name -\u003e\n   (\"f_blablub\" := Json.Decode.int) `Json.Decode.andThen` \\pf_blablub -\u003e\n   Json.Decode.succeed {f_name = pf_name, f_blablub = pf_blablub}\n\njsonEncFoo : Foo -\u003e Value\njsonEncFoo  val =\n   Json.Encode.object\n   [ (\"f_name\", Json.Encode.string val.f_name)\n   , (\"f_blablub\", Json.Encode.int val.f_blablub)\n   ]\n```\n\nAlso, there are functions `Elm.Json.stringSerForSimpleAdt` and `Elm.Json.stringParserForSimpleAdt` to generate functions for your non-JSON ADT types.\n\nFor more usage examples check the tests or the examples dir.\n\n## Install\n\n### Haskell\n\n* Using cabal: `cabal install elm-bridge`\n* From Source: `git clone https://github.com/agrafix/elm-bridge.git \u0026\u0026 cd elm-bridge \u0026\u0026 cabal install`\n\n### Elm\n\n* `elm package install bartavelle/json-helpers`\n\nor, for Elm 0.19:\n\n* `elm install bartavelle/json-helpers`\n\n## Contribute\n\nPull 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Felm-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrafix%2Felm-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Felm-bridge/lists"}