{"id":18423542,"url":"https://github.com/chadtech/random-pipeline","last_synced_at":"2025-04-13T14:45:45.892Z","repository":{"id":57674539,"uuid":"119425457","full_name":"Chadtech/random-pipeline","owner":"Chadtech","description":"This is a package that makes getting random values a little bit easier in Elm.","archived":false,"fork":false,"pushed_at":"2018-08-25T14:33:37.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T07:42:06.418Z","etag":null,"topics":["elm","ran"],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/Chadtech/random-pipeline/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chadtech.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":"2018-01-29T18:48:30.000Z","updated_at":"2021-08-29T02:37:33.000Z","dependencies_parsed_at":"2022-08-29T17:41:06.131Z","dependency_job_id":null,"html_url":"https://github.com/Chadtech/random-pipeline","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Frandom-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Frandom-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Frandom-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chadtech%2Frandom-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chadtech","download_url":"https://codeload.github.com/Chadtech/random-pipeline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732333,"owners_count":21152842,"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":["elm","ran"],"created_at":"2024-11-06T04:37:43.698Z","updated_at":"2025-04-13T14:45:45.859Z","avatar_url":"https://github.com/Chadtech.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Random Pipeline\n\nThis is a package that makes getting random values a little bit easier in Elm.\n\nHeres a side by side comparison between `Random` and `Random.Pipeline`\n\n```elm\n-- Random\nmodelGenerator : Generator Model\nmodelGenerator =\n    Random.map4 Model\n        positionGenerator\n        enemiesGenerator\n        uuidGenerator\n        nameGenerator\n\n\ninit : Seed -\u003e ( Model, Seed )\ninit =\n    Random.step modelGenerator\n\n\n-- Random.Pipeline\nimport Random.Pipeline exposing (from, with)\n\ninit : Seed -\u003e ( Model, Seed )\ninit seed =\n    Model\n        |\u003e from seed\n        |\u003e with positionGenerator\n        |\u003e with enemiesGenerator\n        |\u003e with uuidGenerator\n        |\u003e with nameGenerator\n```\n\nA little bit cleaner right? And what if we wanted to keep the seed in our `Model` too? Just use `Random.Pipeline.finish`\n\n```elm\nimport Random.Pipeline exposing (from, with, finish)\n\ninit : Seed -\u003e Model\ninit seed =\n    Model\n        |\u003e from seed\n        |\u003e with positionGenerator\n        |\u003e with enemiesGenerator\n        |\u003e with uuidGenerator\n        |\u003e with nameGenerator\n        |\u003e finish\n\n\ntype alias Model =\n    { pos : Position\n    , enemies : List Enemy\n    , uuid : Uuid\n    , name : String\n    , seed : Seed\n    }\n```\n\nIt also has `always` that can hardcode values into your random generation.\n\n```elm\nimport Random.Pipeline exposing (from, with, finish, always)\n\nupdate : Msg -\u003e Model -\u003e Model\nupdate msg model =\n    case msg of\n        Restart -\u003e\n            Model\n                |\u003e Random.from model.seed\n                |\u003e Random.with positionGenerator\n                |\u003e Random.with enemiesGenerator\n                |\u003e Random.always model.uuid\n                |\u003e Random.always model.name\n                |\u003e Random.finish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadtech%2Frandom-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchadtech%2Frandom-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadtech%2Frandom-pipeline/lists"}