{"id":16680719,"url":"https://github.com/oltarasenko/epipe","last_synced_at":"2026-03-05T05:30:54.265Z","repository":{"id":62429035,"uuid":"131910395","full_name":"oltarasenko/epipe","owner":"oltarasenko","description":"Brings Elixir's pipe (|\u003e) and with to Erlang world","archived":false,"fork":false,"pushed_at":"2018-09-17T08:47:14.000Z","size":11,"stargazers_count":38,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T18:39:47.076Z","etag":null,"topics":["erlang"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oltarasenko.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-05-02T22:02:16.000Z","updated_at":"2025-06-07T14:15:59.000Z","dependencies_parsed_at":"2022-11-01T20:02:14.460Z","dependency_job_id":null,"html_url":"https://github.com/oltarasenko/epipe","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/oltarasenko/epipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltarasenko%2Fepipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltarasenko%2Fepipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltarasenko%2Fepipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltarasenko%2Fepipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oltarasenko","download_url":"https://codeload.github.com/oltarasenko/epipe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oltarasenko%2Fepipe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30111743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["erlang"],"created_at":"2024-10-12T13:42:27.243Z","updated_at":"2026-03-05T05:30:54.247Z","avatar_url":"https://github.com/oltarasenko.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"epipe \n=====\n\n[![Build Status](https://travis-ci.org/oltarasenko/epipe.svg?branch=master)](https://travis-ci.org/oltarasenko/epipe)\n[![Hex pm](http://img.shields.io/hexpm/v/epipe.svg?style=flat)](https://hex.pm/packages/epipe) [![hex.pm downloads](https://img.shields.io/hexpm/dt/epipe.svg?style=flat)](https://hex.pm/packages/epipe)\n\nErlang pipes\n\nInfluenced by Elixir pipe (|\u003e) and with operators. Brings similar functionality to erlang\n\n\nIntro\n-----\n\nProbably you've seen code like this:\n\n``` erlang\ncase gen_tcp:connect(Host, Port, Otps) of\n    {ok, Socket} -\u003e \n        case do_handshake(Socket) of\n            ok -\u003e send_message(Socket);\n            {error, Reason} -\u003e exit(normal)\n        end;\n    {error, Reason} -\u003e exit(normal)\nend\n\n```\n\nSometimes the amount of the nested cases goes even deeper.... Which makes the code quite\ncomplex for understanding and debugging.\n\nEpipe allows to rewrite it in a very flat way:\n\n``` erlang\nconnect({Host, Port, Opts}) -\u003e \n    case gen_tcp:connect(Host, Port, Otps) of\n        {ok, Socket} -\u003e {ok, Socket};\n        {error, Reason} -\u003e {error, Reason}\n    end.\n\nhandshake(Socket) -\u003e \n    case do_handshake(Socket) of\n        ok -\u003e {ok, Socket};\n        {error, Reason} -\u003e {error, Reason}\n    end.\n\nsend_message(Socket) -\u003e\n    case do_send_message(Socket) of\n        response -\u003e {ok, response};\n        Error -\u003e {error, Error}\n    end.\n\nFunctionsList = [\n    {connect_fun, fun connect/1}, \n    {handshake_fun, fun handshake/1}, \n    {send_message_fun, fun send_message/1}\n],\nepipe:run(FunctionsList, {Host, Port, Opts}).\n\n```\n\nWhich allows to 'pipe' the initial data through FunctionsList, stopping on any step\nwhich would produce {error, ...} value.\n\nExamples\n--------------\n```\nsample1() -\u003e \n    Fun1 = fun(Val) -\u003e {ok, Val + 1} end,\n    Fun2 = fun(Val) -\u003e {ok, Val + 2} end,\n    epipe:run([{add_one, Fun1}, {add_two, Fun2}], 0).\n```\n\nWould produce {ok, 3}\n\n```\nsample2() -\u003e \n    Fun1 = fun(Val) -\u003e {ok, Val + 1} end,\n    Fun2 = fun(Val) -\u003e {error, \"Can't process data\"} end,\n    epipe:run([{step1, Fun1}, {step2, Fun2}, {step3, Fun1}], 0).\n```\n\n\nWould produce {error, step2, \"Can't process data\", 1}, giving not only error reason,\nbut also would give a hint, about the failing step. \n\n\nBuild\n-----\n\n    $ rebar3 compile\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foltarasenko%2Fepipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foltarasenko%2Fepipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foltarasenko%2Fepipe/lists"}