Skip to content

Releases: mrxrsd/arpl

v1.0.12

28 Sep 02:42

Choose a tag to compare

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

13 Sep 20:40
026b058

Choose a tag to compare

Full Changelog: 1.0.10...v1.0.11

ARPL v1.0.11 🚀

What's Changed 🆕

Enhanced Ergonomics with Implicit Conversions ✨

  • From L or R to Either<L, R>: The highlight of this release is the introduction of implicit conversions from the base types L and R directly into an Either<L, R>. This significantly simplifies the creation of Either instances, 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.11

0.1.0

04 May 20:06

Choose a tag to compare

ARPL.AspNetCore v0.1.0 (Preview)

First release of the ASP.NET Core integration package for ARPL.

Features

  • 🔄 Easy conversion from SResult<T> to ActionResult via 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.0

Dependencies

  • 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

02 May 23:48

Choose a tag to compare

Full Changelog: 1.0.9...1.0.10

ARPL 1.0.10 🚀

What's Changed 🆕

Functional Methods Enhancement ⚡

  • Added Do and DoAsync methods for performing actions while preserving monad type
  • Added Transform and TransformAsync methods 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

01 May 01:09

Choose a tag to compare

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 call

Quality Improvements 🛠️

  • Expanded test coverage for new Bind operations
  • Enhanced code documentation with clear examples
  • Fixed test edge cases and documentation typos

1.0.6

29 Apr 02:46

Choose a tag to compare

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

26 Apr 02:58

Choose a tag to compare

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 collection
    • SequenceAsync - Async version of Sequence
    • Traverse - Map and sequence in one step
    • TraverseAsync - Async version of Traverse
    • Apply - Transform both success and error values
    • ApplyAsync - Async version of Apply

Code Organization

  • Split functional methods into separate files for better organization:
    • Either.Functional.cs
    • Either.Extensions.cs
    • SResult.Functional.cs
    • SResult.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.cs
    • SResultFunctionalTests.cs
    • EitherExtensionsTests.cs
    • SResultExtensionsTests.cs
    • ErrorCollectionTests.cs

1.0.4

25 Apr 02:07

Choose a tag to compare

Full Changelog: 1.0.3...1.0.4

ARPL 1.0.4 Release Notes

🚀 Enhancements

Improved Error Handling

  • Changed Errors.EmptyError() return type from Error to ErrorCollection for better type safety and improved developer experience
  • Now you can directly use the Add method on the result of EmptyError() 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 from Error to ErrorCollection
  • 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

24 Apr 02:29

Choose a tag to compare

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

19 Apr 19:05

Choose a tag to compare