{"id":15798868,"url":"https://github.com/ilyakooo0/elm-ps-bridge","last_synced_at":"2026-04-16T04:32:20.965Z","repository":{"id":48850661,"uuid":"516814647","full_name":"ilyakooo0/elm-ps-bridge","owner":"ilyakooo0","description":"🌉 A PureScript-Elm bridge generator","archived":false,"fork":false,"pushed_at":"2022-09-11T08:20:41.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T01:01:21.884Z","etag":null,"topics":["elm","json","purescript"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/ilyakooo0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-22T16:17:29.000Z","updated_at":"2023-05-21T11:21:24.000Z","dependencies_parsed_at":"2023-01-18T03:30:49.056Z","dependency_job_id":null,"html_url":"https://github.com/ilyakooo0/elm-ps-bridge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ilyakooo0/elm-ps-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyakooo0%2Felm-ps-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyakooo0%2Felm-ps-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyakooo0%2Felm-ps-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyakooo0%2Felm-ps-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilyakooo0","download_url":"https://codeload.github.com/ilyakooo0/elm-ps-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilyakooo0%2Felm-ps-bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31871561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["elm","json","purescript"],"created_at":"2024-10-05T01:00:34.939Z","updated_at":"2026-04-16T04:32:20.946Z","avatar_url":"https://github.com/ilyakooo0.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm PS Bridge\n\nA very rough tool to generate compatible ELm and PS type definitions from a common YAML definition. I intend to use them to communicate through Elm  ports.\n\n## Example\n\n```bash\nelm-ps-bridge --input example.yaml --elmOutput Bridge.elm --psOutput Bridge.purs\n```\n\n### `example.yaml`\n\n```yaml\nSubscription:\n- DownloadPasswords\n- UpdatePassword:\n    foo: Int\n    id: Int\nCommand:\n- Hello\n```\n\n\n### `Bridge.purs`\n\n```purescript\n-- File auto generated by purescript-bridge! --\nmodule Bridge where\n\nimport Data.Generic.Rep (class Generic)\nimport Data.Lens (Iso', Lens', Prism', lens, prism')\nimport Data.Lens.Iso.Newtype (_Newtype)\nimport Data.Lens.Record (prop)\nimport Data.Maybe (Maybe(..))\nimport Data.Newtype (class Newtype)\nimport Data.Symbol (SProxy(SProxy))\n\nimport Prelude\n\ndata Command =\n    Hello\n\nderive instance genericCommand :: Generic Command _\nderive instance newtypeCommand :: Newtype Command _\nderive instance eqCommand :: Eq Command\nderive instance ordCommand :: Ord Command\n\n--------------------------------------------------------------------------------\n_Hello :: Prism' Command Unit\n_Hello = prism' (\\_ -\u003e Hello) f\n  where\n    f Hello = Just unit\n\n--------------------------------------------------------------------------------\nnewtype Subscription_UpdatePassword =\n    Subscription_UpdatePassword {\n      foo :: Int\n    , id :: Int\n    }\n\nderive instance genericSubscription_UpdatePassword :: Generic Subscription_UpdatePassword _\nderive instance newtypeSubscription_UpdatePassword :: Newtype Subscription_UpdatePassword _\nderive instance eqSubscription_UpdatePassword :: Eq Subscription_UpdatePassword\nderive instance ordSubscription_UpdatePassword :: Ord Subscription_UpdatePassword\n\n--------------------------------------------------------------------------------\n_Subscription_UpdatePassword :: Iso' Subscription_UpdatePassword { foo :: Int, id :: Int}\n_Subscription_UpdatePassword = _Newtype\n\n--------------------------------------------------------------------------------\ndata Subscription =\n    DownloadPasswords\n  | UpdatePassword Subscription_UpdatePassword\n\nderive instance genericSubscription :: Generic Subscription _\nderive instance newtypeSubscription :: Newtype Subscription _\nderive instance eqSubscription :: Eq Subscription\nderive instance ordSubscription :: Ord Subscription\n\n--------------------------------------------------------------------------------\n_DownloadPasswords :: Prism' Subscription Unit\n_DownloadPasswords = prism' (\\_ -\u003e DownloadPasswords) f\n  where\n    f DownloadPasswords = Just unit\n    f _ = Nothing\n\n_UpdatePassword :: Prism' Subscription Subscription_UpdatePassword\n_UpdatePassword = prism' UpdatePassword f\n  where\n    f (UpdatePassword a) = Just $ a\n    f _ = Nothing\n\n--------------------------------------------------------------------------------\n```\n\n### `Bridge.elm`\n\n```elm\nmodule Bridge exposing(..)\n\nimport Json.Decode\nimport Json.Encode exposing (Value)\n-- The following module comes from bartavelle/json-helpers\nimport Json.Helpers exposing (..)\nimport Dict exposing (Dict)\nimport Set exposing (Set)\n\n\ntype Command  =\n    Hello\n\njsonDecCommand : Json.Decode.Decoder ( Command )\njsonDecCommand =\n    let jsonDecDictCommand = Dict.fromList [(\"Hello\", Hello)]\n    in  decodeSumUnaries \"Command\" jsonDecDictCommand\n\njsonEncCommand : Command -\u003e Value\njsonEncCommand  val =\n    case val of\n        Hello -\u003e Json.Encode.string \"Hello\"\n\n\n\ntype alias Subscription_UpdatePassword  =\n   { foo: Int\n   , id: Int\n   }\n\njsonDecSubscription_UpdatePassword : Json.Decode.Decoder ( Subscription_UpdatePassword )\njsonDecSubscription_UpdatePassword =\n   Json.Decode.succeed (\\pfoo pid -\u003e {foo = pfoo, id = pid})\n   |\u003e required \"foo\" (Json.Decode.int)\n   |\u003e required \"id\" (Json.Decode.int)\n\njsonEncSubscription_UpdatePassword : Subscription_UpdatePassword -\u003e Value\njsonEncSubscription_UpdatePassword  val =\n   Json.Encode.object\n   [ (\"foo\", Json.Encode.int val.foo)\n   , (\"id\", Json.Encode.int val.id)\n   ]\n\n\n\ntype Subscription  =\n    DownloadPasswords\n    | UpdatePassword Subscription_UpdatePassword\n\njsonDecSubscription : Json.Decode.Decoder ( Subscription )\njsonDecSubscription =\n    let jsonDecDictSubscription = Dict.fromList\n            [ (\"DownloadPasswords\", Json.Decode.lazy (\\_ -\u003e Json.Decode.succeed DownloadPasswords))\n            , (\"UpdatePassword\", Json.Decode.lazy (\\_ -\u003e Json.Decode.map UpdatePassword (jsonDecSubscription_UpdatePassword)))\n            ]\n    in  decodeSumObjectWithSingleField  \"Subscription\" jsonDecDictSubscription\n\njsonEncSubscription : Subscription -\u003e Value\njsonEncSubscription  val =\n    let keyval v = case v of\n                    DownloadPasswords  -\u003e (\"DownloadPasswords\", encodeValue (Json.Encode.list identity []))\n                    UpdatePassword v1 -\u003e (\"UpdatePassword\", encodeValue (jsonEncSubscription_UpdatePassword v1))\n    in encodeSumObjectWithSingleField keyval val\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filyakooo0%2Felm-ps-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filyakooo0%2Felm-ps-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filyakooo0%2Felm-ps-bridge/lists"}