{"id":31221571,"url":"https://github.com/thma/jiffy","last_synced_at":"2025-09-21T20:53:46.773Z","repository":{"id":315920624,"uuid":"1060377992","full_name":"thma/jiffy","owner":"thma","description":"algebraic effects for Java","archived":false,"fork":false,"pushed_at":"2025-09-21T15:22:49.000Z","size":48,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T17:37:17.237Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/thma.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-19T20:09:21.000Z","updated_at":"2025-09-21T15:22:02.000Z","dependencies_parsed_at":"2025-09-21T17:49:44.993Z","dependency_job_id":null,"html_url":"https://github.com/thma/jiffy","commit_stats":null,"previous_names":["thma/jiffy"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/thma/jiffy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thma%2Fjiffy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thma%2Fjiffy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thma%2Fjiffy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thma%2Fjiffy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thma","download_url":"https://codeload.github.com/thma/jiffy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thma%2Fjiffy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276305449,"owners_count":25619518,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"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":[],"created_at":"2025-09-21T20:53:43.584Z","updated_at":"2025-09-21T20:53:46.766Z","avatar_url":"https://github.com/thma.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jiffy - Algebraic Effects for Java\n\nJiffy is a lightweight library that brings algebraic effects to Java with compile-time effect checking through annotations.\n\n## Features\n\n- 🔍 **Compile-time effect checking** - Catch missing effect declarations during compilation\n- 📝 **Annotation-based** - Use familiar Java annotations to declare effects\n- 🎯 **Type-safe** - Effects are visible in method signatures\n- 🔧 **Extensible** - Easy to add new effects and handlers\n- 🏗️ **Spring-friendly** - Integrates well with Spring Boot applications\n- ⚡ **Minimal overhead** - Efficient runtime with direct handler dispatch\n\n## Quick Start\n\n### Define an Effect\n\n```java\npublic sealed interface LogEffect extends Effect\u003cVoid\u003e {\n    record Info(String message) implements LogEffect {}\n    record Error(String message, Throwable cause) implements LogEffect {}\n}\n```\n\n### Use Effects in Your Code\n\n```java\nimport org.jiffy.annotations.Uses;\nimport org.jiffy.core.Eff;\n\npublic class UserService {\n\n    @Uses({LogEffect.class, DatabaseEffect.class})\n    public Eff\u003cUser\u003e findUser(Long id) {\n        return Eff.perform(new LogEffect.Info(\"Finding user \" + id))\n            .flatMap(ignored -\u003e\n                Eff.perform(new DatabaseEffect.Query(\"SELECT * FROM users WHERE id = \" + id))\n            )\n            .map(result -\u003e parseUser(result));\n    }\n}\n```\n\n### Handle Effects\n\n```java\npublic class LogHandler implements EffectHandler\u003cLogEffect\u003e {\n    @Override\n    public void handle(LogEffect effect, EffectRuntime runtime) {\n        switch (effect) {\n            case LogEffect.Info(var message) -\u003e System.out.println(\"[INFO] \" + message);\n            case LogEffect.Error(var message, var cause) -\u003e System.err.println(\"[ERROR] \" + message);\n        }\n    }\n}\n```\n\n### Run with Runtime\n\n```java\nEffectRuntime runtime = new EffectRuntime()\n    .with(LogEffect.class, new LogHandler())\n    .with(DatabaseEffect.class, new DatabaseHandler());\n\nUser user = findUser(123L).runWith(runtime);\n```\n\n## Compile-Time Checking\n\nThe annotation processor validates that all effects used in a method are declared:\n\n```java\n@Uses({LogEffect.class})  // Missing DatabaseEffect!\npublic Eff\u003cUser\u003e findUser(Long id) {\n    return Eff.perform(new DatabaseEffect.Query(\"...\"))  // Compile error!\n        .map(this::parseUser);\n}\n```\n\n## Installation\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.jiffy\u003c/groupId\u003e\n    \u003cartifactId\u003ejiffy\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```gradle\nimplementation 'org.jiffy:jiffy:1.0.0-SNAPSHOT'\n```\n\n## Core Concepts\n\n### Effects\nEffects represent side effects as data. They extend the `Effect\u003cT\u003e` interface where `T` is the return type.\n\n### Eff Monad\n`Eff\u003cT\u003e` is a monadic type that represents a computation that may perform effects and produce a value of type `T`.\n\n### Effect Handlers\nHandlers interpret effects. They implement `EffectHandler\u003cE\u003e` where `E` is the effect type.\n\n### Annotations\n- `@Uses` - Declares which effects a method may use\n- `@Pure` - Marks methods as effect-free\n- `@UncheckedEffects` - Allows specific effects without declaration\n- `@Provides` - Indicates a method provides effect handlers\n\n## Advanced Features\n\n### Parallel Effects\n```java\nEff.parallel(\n    fetchUserData(userId),\n    fetchUserOrders(userId)\n).map(pair -\u003e new UserProfile(pair.getFirst(), pair.getSecond()));\n```\n\n### Effect Recovery\n```java\nfetchData()\n    .recover(error -\u003e {\n        log(\"Failed to fetch data: \" + error);\n        return defaultData();\n    });\n```\n\n### Sequential Composition\n```java\nEff.sequence(\n    validateInput(data),\n    saveToDatabase(data),\n    notifyUser(userId)\n);\n```\n\n## Documentation\n\n- [User Guide](docs/USER_GUIDE.md)\n- [API Documentation](docs/API.md)\n- [Effect Comparison](docs/EFFECT_COMPARISON.md)\n- [Examples](examples/)\n\n## Building from Source\n\n```bash\ngit clone https://github.com/yourusername/jiffy.git\ncd jiffy\nmvn clean install\n```\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Inspired by algebraic effects in OCaml, Koka, and Haskell\n- Similar projects: [Jeff](https://github.com/lpld/jeff), ZIO, Arrow-kt\n- Built for the Java community with ❤️","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthma%2Fjiffy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthma%2Fjiffy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthma%2Fjiffy/lists"}