Releases: mrxrsd/arpl
Releases · mrxrsd/arpl
v1.0.12
Full Changelog: v1.0.11...v1.0.12
ARPL v1.0.12 🚀
What's Changed 🆕
- Fixed [ErrorCollection.Add(...)]to align with [Merge] semantics: flatten nested collections and ignore empty ones for correct aggregation.
- Added unit tests to guarantee the new behavior for nested and empty collections.
1.0.11
Full Changelog: 1.0.10...v1.0.11
ARPL v1.0.11 🚀
What's Changed 🆕
Enhanced Ergonomics with Implicit Conversions ✨
- From
LorRtoEither<L, R>: The highlight of this release is the introduction of implicit conversions from the base typesLandRdirectly into anEither<L, R>. This significantly simplifies the creation ofEitherinstances, making your code more concise and readable.
Usage Example 💡
// A function that returns an Either<string, int>
public Either<string, int> ParseNumber(string input)
{
if (string.IsNullOrEmpty(input))
{
// Implicitly converts the string to Either<string, int>.Left
return "Input cannot be null or empty.";
}
if (int.TryParse(input, out var number))
{
// Implicitly converts the int to Either<string, int>.Right
return number;
}
return "Invalid number format.";
}
// Usage remains the same
Either<string, int> result = ParseNumber("123");
result.Match(
error => Console.WriteLine($"Error: {error}"),
success => Console.WriteLine($"Success: {success}")
);Installation 📦
dotnet add package ARPL --version 1.0.110.1.0
ARPL.AspNetCore v0.1.0 (Preview)
First release of the ASP.NET Core integration package for ARPL.
Features
- 🔄 Easy conversion from
SResult<T>toActionResultvia extension methods - 🎯 Default HTTP status code mapping:
- Success results -> 200 OK
- Expected errors -> 400 Bad Request
- Unexpected errors -> 500 Internal Server Error
- ⚙️ Customizable error handling through
ArplAspNetCore.Setup - 🔌 Seamless integration with ASP.NET Core controllers
Installation
dotnet add package ARPL.AspNetCore --version 0.1.0Dependencies
- ARPL v1.0.10
- .NET 6.0, .NET 7.0, or .NET 8.0
Breaking Changes
- None (first release)
Examples
Basic Usage
public class UserController : ControllerBase
{
[HttpGet("{id}")]
public async Task<ActionResult<User>> GetUser(int id)
{
var result = await _userService.GetUserById(id);
return result.ToActionResult();
}
}Custom Error Handling
ArplAspNetCore.Setup(cfg => {
cfg.ErrorHandler = error => error switch
{
NotFoundError => new NotFoundObjectResult(new {
error = "Resource not found",
details = error.Messages
}),
_ => new ObjectResult(new {
error = "Internal server error",
details = error.Messages
})
{
StatusCode = StatusCodes.Status500InternalServerError
}
};
});Known Issues
- None
Notes
- This is a preview release. API may change before the stable release.
- Please report any issues on GitHub.
1.0.10
Full Changelog: 1.0.9...1.0.10
ARPL 1.0.10 🚀
What's Changed 🆕
Functional Methods Enhancement ⚡
- Added
DoandDoAsyncmethods for performing actions while preserving monad type - Added
TransformandTransformAsyncmethods for powerful monad transformations
Documentation Updates 📚
- Enhanced README with detailed examples and use cases for new methods
- Added best practices and warnings about responsible Transform usage
- Improved documentation clarity for async/sync method integration
Code Quality 🛠️
- Improved test coverage for new functional methods
- Fixed async method implementation in SResult.DoAsync
- Ensured consistent behavior across Either and SResult implementations
Usage Example 💡
// Using Do for side effects while preserving monad type
await GetUserAsync(id)
.Do(result => _metrics.TrackOperation("user_access"))
.Map(user => user.Profile)
.Transform(result => result.IsSuccess
? new UserViewModel(result.SuccessValue)
: UserViewModel.Error(result.ErrorValue.Message));1.0.9
Full Changelog: 1.0.6...1.0.9
ARPL 1.0.9 🚀
What's Changed 🆕
Architecture Improvements 🏗️
- Complete code reorganization for crystal-clear separation of concerns:
- Core classes now split into base structure and functional methods
- Test suite reorganized for better maintainability
- Enhanced documentation with practical examples
Try Pattern Support 🎯
- New Try Pattern implementation for elegant error handling:
var result = await SResult
.Try(() => riskyOperation())
.BindAsync(async data => await processDataAsync(data));Seamless Async/Sync Integration 🔄
- Mix and match sync and async operations effortlessly:
// Combine sync validations with async operations
await result
.Bind(ValidateInput) // Sync validation
.BindAsync(SaveToDbAsync) // Async operation
.Bind(PrepareResponse) // Back to sync
.BindAsync(NotifyUserAsync); // Final async callQuality Improvements 🛠️
- Expanded test coverage for new Bind operations
- Enhanced code documentation with clear examples
- Fixed test edge cases and documentation typos
1.0.6
Full Changelog: 1.0.5...1.0.6
ARPL 1.0.6 🚀
What's Changed 🆕
Error Handling Improvements ✨
- Added
HasExceptionOf<T>()method to check exception types in a type-safe way:if (error.HasExceptionOf<DbException>()) Console.WriteLine("Database error occurred");
- Improved error type checking with enhanced
HasErrorOf<T>()method
Documentation Updates 📚
- Updated README.md with new error handling features and examples
- Added comprehensive examples for exception type checking
- Enhanced error handling documentation with best practices
1.0.5
Full Changelog: 1.0.4...1.0.5
ARPL 1.0.5 Release Notes
🚀 New Features
Functional Methods
- Added new functional methods for composing and transforming values:
Sequence- Transform a collection of Either/SResult into an Either/SResult of collectionSequenceAsync- Async version of SequenceTraverse- Map and sequence in one stepTraverseAsync- Async version of TraverseApply- Transform both success and error valuesApplyAsync- Async version of Apply
Code Organization
- Split functional methods into separate files for better organization:
Either.Functional.csEither.Extensions.csSResult.Functional.csSResult.Extensions.cs
Documentation
- Updated README with comprehensive examples and better organization
- Added detailed sections for functional methods
- Improved error handling documentation
- Added examples for error composition and enumeration
🧪 Tests
- Added new test suites:
EitherFunctionalTests.csSResultFunctionalTests.csEitherExtensionsTests.csSResultExtensionsTests.csErrorCollectionTests.cs
1.0.4
Full Changelog: 1.0.3...1.0.4
ARPL 1.0.4 Release Notes
🚀 Enhancements
Improved Error Handling
- Changed
Errors.EmptyError()return type fromErrortoErrorCollectionfor better type safety and improved developer experience - Now you can directly use the
Addmethod on the result ofEmptyError()without casting
Documentation Updates
- Added new comprehensive Error Handling section in README
- Added examples for working with single errors and error collections
- Improved documentation clarity for error handling features
🔄 Changes
- Return type of
Errors.EmptyError()changed fromErrortoErrorCollection - Updated documentation to reflect the new error handling patterns
💡 Usage Example
// Before (1.0.3)
var errors = (ErrorCollection)Errors.EmptyError();
errors.Add(newError);
// Now (1.0.4)
var errors = Errors.EmptyError();
errors.Add(newError);1.0.3
Full Changelog: 1.0.2...1.0.3
Release Notes
Version 1.0.3
Released on 2025-04-23
Changes between 1.0.2 and 1.0.3
Core Library Changes
Either<L,R>
- Added MapAsync method for asynchronous transformations
- Enhanced method documentation
Documentation
- Updated README.md with improved examples and usage guidelines
- Added documentation for new async functionality
Contributors
- mrxrsd
1.0.2
Full Changelog: https://github.com/mrxrsd/arpl/commits/1.0.2