{"id":16603158,"url":"https://github.com/laserpants/elm-update-pipeline","last_synced_at":"2025-04-16T02:44:44.915Z","repository":{"id":62418725,"uuid":"225163573","full_name":"laserpants/elm-update-pipeline","owner":"laserpants","description":"Elm interface for sequential composition of updates in the style of pipelines.","archived":false,"fork":false,"pushed_at":"2020-03-20T11:17:47.000Z","size":53,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T04:24:42.957Z","etag":null,"topics":["applicative","elm","monad","update"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/laserpants/elm-update-pipeline/latest/","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/laserpants.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":"2019-12-01T13:10:35.000Z","updated_at":"2024-11-02T21:50:00.000Z","dependencies_parsed_at":"2022-11-01T16:46:18.811Z","dependency_job_id":null,"html_url":"https://github.com/laserpants/elm-update-pipeline","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Felm-update-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Felm-update-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Felm-update-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laserpants%2Felm-update-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laserpants","download_url":"https://codeload.github.com/laserpants/elm-update-pipeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249185938,"owners_count":21226642,"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":["applicative","elm","monad","update"],"created_at":"2024-10-12T00:47:52.496Z","updated_at":"2025-04-16T02:44:44.860Z","avatar_url":"https://github.com/laserpants.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm Update Pipeline\n\n[![Build Status](https://img.shields.io/travis/laserpants/elm-update-pipeline/master.svg?style=flat)](https://travis-ci.org/laserpants/elm-update-pipeline)\n[![Version](https://img.shields.io/badge/elm--version-0.19-blue.svg?colorB=ff69b4)](http://elm-lang.org/)\n\nA library for sequential composition of updates in the convenient style of _pipelines_, where functions are chained together using the pipe operator.\nFor example;\n\n```elm\nupdate msg model =\n    case msg of\n        SomeMsg someMsg -\u003e\n            save model\n                |\u003e andThen (setPower 100)\n                |\u003e andAddCmd someCmd\n```\n\nMonadic functions of type `a -\u003e ( b, Cmd msg )` form the building blocks of a pipeline.\nWe use `save` to create an update without any commands, and `andThen` to extract the model from a result and pass it as input to the next function in the pipeline.\n\n```elm\nshowToast : String -\u003e Model -\u003e ( Model, Cmd msg )\nshowToast = ...\n\nsetColor : Color -\u003e Model -\u003e ( Model, Cmd msg )\nsetColor color model =\n    save { model | color = color }\n\nupdate : Msg -\u003e Model -\u003e ( Model, Cmd Msg )\nupdate msg model =\n    model\n        |\u003e setColor Orange\n        |\u003e andThen (showToast \"Color changed to orange\")\n```\n\nThe applicative interface, `map2`, `map3`, etc., together with `andMap`, addresses the need to map functions with more than one parameter over `( model, Cmd msg )` inputs.\n\n```elm\ntype alias Model =\n    { menuOpen : Bool, session : Session, router : Router.Model }\n\ninitSession : Flags -\u003e ( Session, Cmd Msg )\ninitSession = ...\n\ninit : Flags -\u003e ( Model, Cmd Msg )\ninit flags =\n    save Model\n        |\u003e andMap (save False)\n        |\u003e andMap (initSession flags)\n        |\u003e andMap initRouter\n```\n\nIn this example, `init` can also be defined as\n\n```elm\ninit flags =\n    map3 Model (save False) (initSession flags) initRouter\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaserpants%2Felm-update-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaserpants%2Felm-update-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaserpants%2Felm-update-pipeline/lists"}