effect_dart 0.1.0
effect_dart: ^0.1.0 copied to clipboard
A powerful Effect library for Dart inspired by Effect-TS, providing functional programming patterns for managing side effects, errors, and dependencies.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.1.0 - 2025-01-07 #
Added #
- Initial release of Effect.dart library
- Core
Effect<Success, Error, Requirements>
type with type-safe error handling - Basic effect constructors:
Effect.succeed()
- Create successful effectsEffect.fail()
- Create failed effectsEffect.sync()
- Synchronous computations that may throwEffect.async()
- Asynchronous computationsEffect.service()
- Dependency injection effects
- Effect transformation methods:
map()
- Transform success valuesmapError()
- Transform error valuesflatMap()
- Chain effects togethercatchAll()
- Handle and recover from errors
- Context system for dependency injection:
Context<R>
type for managing servicesprovideContext()
andprovideService()
for providing dependencies- Type-safe service retrieval
- Exit system representing effect results:
Success<A>
andFailure<E>
exit typesCause<E>
system for error classification (Fail
vsDie
)
- Runtime system for executing effects:
Runtime.defaultRuntime
singletonrunToExit()
for safe executionrunUnsafe()
for throwing execution- Concurrent execution with
runConcurrently()
andrunRace()
- Fiber system for managing concurrent effects
- Either type for functional error handling:
Either<L, R>
withLeft
andRight
cases- Functional operations like
map
,flatMap
,fold
- Comprehensive test suite covering all major functionality
- Example code demonstrating library usage
- Complete API documentation in README.md
- Melos configuration for project management
- Strict linting rules for code quality
Features #
- Type Safety: Complete type safety for success values, errors, and dependencies
- Lazy Evaluation: Effects are pure descriptions that don't execute until run
- Composability: Chain and combine effects using functional operations
- Error Handling: Built-in typed error handling with recovery mechanisms
- Dependency Injection: Type-safe context system inspired by Effect-TS
- Concurrency: Built-in support for parallel and concurrent execution
- Resource Management: Safe resource handling through the effect system
Documentation #
- Comprehensive README with examples and API reference
- Inline documentation for all public APIs
- Working examples in
example/
directory - Test suite demonstrating usage patterns
Development #
- Melos configuration for monorepo-style development
- Comprehensive linting rules
- Automated testing setup
- Example code for library demonstration
[Unreleased] #
Planned #
- More concurrent combinators (timeout, retry, etc.)
- Resource management with bracket patterns
- Streaming support with Effect streams
- Performance optimizations
- Additional utility functions and combinators