{"id":32148762,"url":"https://github.com/to4iki/reader","last_synced_at":"2026-02-19T08:01:46.155Z","repository":{"id":62452621,"uuid":"125740787","full_name":"to4iki/Reader","owner":"to4iki","description":"function wrapper ⚔","archived":false,"fork":false,"pushed_at":"2018-12-22T15:20:27.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-15T02:42:39.184Z","etag":null,"topics":["di","reader","reader-monad"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/to4iki.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-03-18T15:43:27.000Z","updated_at":"2019-04-16T02:01:53.000Z","dependencies_parsed_at":"2022-11-01T22:46:28.792Z","dependency_job_id":null,"html_url":"https://github.com/to4iki/Reader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/to4iki/Reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/to4iki%2FReader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/to4iki%2FReader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/to4iki%2FReader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/to4iki%2FReader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/to4iki","download_url":"https://codeload.github.com/to4iki/Reader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/to4iki%2FReader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["di","reader","reader-monad"],"created_at":"2025-10-21T09:09:21.472Z","updated_at":"2026-02-19T08:01:46.150Z","avatar_url":"https://github.com/to4iki.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reader\n[![Swift 4.2][swift-image]][swift-url]\n[![Build Status][status-image]][status-url]\n[![Carthage compatible][carthage-image]][carthage-url]\n\nReader monad in Swift, inspired by [implemention with Scala](https://gist.github.com/Mortimerp9/5384467).\n\n## Overview\n`Reader` is a wrapper for function that take some `Input` and produce `Element`.\n\n```swift\n// init(_:)\nlet reader = Reader\u003cInt, Int\u003e { $0 + 2 }\n\n// execute(_:)\nreader.execute(1) // 3\nreader.execute(2) // 4\n\n// map(_:)\nreader\n    .map { $0 * 2 }\n    .execute(3) // 10\n\n// flatMap(_:)\nreader\n    .flatMap { i1 in Reader\u003cInt, Int\u003e { i2 in i1 * i2 } }\n    .execute(4) // 24\n```\n\n## :syringe:\nSimple and static **Dependency Injection** is possible with `Reader`\n\nexample: [Playground](DependencyInjection.playground/Contents.swift)\n\n## Installation\n\n#### [Carthage](https://github.com/Carthage/Carthage)\nAdd following line into your Cartfile and run `carthage update`.\n\n```shell\ngithub \"to4iki/Reader\"\n```\n\n#### [SwiftPackage Manager](https://github.com/apple/swift-package-manager)\nAdd following line into your Package.swift and run `swift build`.\n\n```swift\ndependencies: [\n    .Package(url: \"https://github.com/to4iki/Reader.git\", majorVersion: 0)\n]\n```\n\n[swift-url]: https://swift.org/download/\n[swift-image]: https://img.shields.io/badge/swift-4.2-orange.svg?style=flat\n\n[status-url]: https://travis-ci.org/to4iki/Reader\n[status-image]: https://travis-ci.org/to4iki/Reader.svg\n\n[carthage-url]: https://github.com/Carthage/Carthage\n[carthage-image]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fto4iki%2Freader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fto4iki%2Freader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fto4iki%2Freader/lists"}