Skip to content

Improved: Record GetHashCode and RWS/Reader Code-Gen

Compare
Choose a tag to compare
@louthy louthy released this 28 Sep 16:54
96de33c

release

  • Record types now have an improved hash-code algorithm, based on the FNV 1a hashing algorithm

  • Reader and RWS code-generators will now look for existing methods with the same name as the one they're going to generate. If existing methods exist then the methods won't be generated.

    • This allows for things like bespoke Bind implementations without having to build everything by hand.
  • Map, Select, and SelectMany are now implemented with Bind. So they will also leverage any bespoke Bind methods.

  • Where is implemented with Filter, which means providing a bespoke Filter method will also update the Where

  • Added Match(Action<A> Succ, Action<Error> Fail) for side-effecting matching to RWSResult and ReaderResult

  • Added IfFailThrow() to RWSResult and ReaderResult

  • Bug fix: for RWS.Run which was still returning a tuple after the refactor for better error handling. It now returns RWSResult.

  • Bug fix: Where implementation typo for Arr<A>

Thanks to: @alaendle and @EdruptCo for the fixes.

non-release notes

There is a new sample based on the famous Contoso app. @blakeSaucier has kindly converted it over to be more functional, using many of the features of language-ext. Going forward I will try and de-interface it and make it more pure and monadic, but this is a fantastic starting point to give developers guidance on how they can be more functional with their C# code.