scott-ainsworth / dotnet-eithers Goto Github PK
View Code? Open in Web Editor NEWAn experimental C# implementation of the maybe monad
License: MIT License
An experimental C# implementation of the maybe monad
License: MIT License
Issue: The SonarLint Visual Studio extension only works in Visual Studio for Windows. Much of my work is on a Mac.
Requirements
Requirements:
Results
capability. It should be similar to the Maybe
capability in design, but instead of None, it will have an error class.Issue: The .editorconfig
file has not received the love it needs; so, it is likely that many formatting settings, warning, etc. are not optimally set.
*Requirements:
.editorconfig
Issue: Currently, the code covers files a folders are a bit scattered, which makes managing them (e.g., in .gitignore
) somewhat error prone.
Requirements
Issue: Many of the tests are near-clones, varying only by type.
Requirements
Issue: Although marked not to accept a null value
argument, code that does not have null analysis enabled (#nullable enable
in C#) can still provide a null argument.
Requirements
Some<T>
must throw ArgumentNullException
with the value
argument is null.Verification
ArgumentNullException
is thrown.Issue: The design of this library relies on proper construction instances. For example, there should be only one instance of each None<T>
.
Requirements
Constructor Visibility Specs
Maybe<T>
: constructors must be protected to avoid subclassing outside this library.Some<T>
: constructors must be internal to allow instance creation by the library.None<T>
: constructors must be private to ensure only singleton instance is created.Issue: Originally, the unit tests relied on constant and readonly values defined in the TestData
class. This turned out to make the test code harder to grok.
Requirements
TestData
.Issue: try-get-value is a common pattern in .NET when a value may or may not be available (see Dictionary<TKey,TValue>.TryGetvalue(TKey, out TValue).
Requirements:
TryGetValue
for Maybe.TryGetValue
for Result.TryGetException
for Result.Issue: Running SonarLint identified minor problems and some potential refactoring.
Requirements: Refactor and remove unnecessary code as needed.
object.GetHashCode()
) and suppress resulting false positive SonarLint diagnostics.#nullable enable
s.Issue: As part of implementing Results
(see #23), numerous modifications and improvements were made to ensure alignment in structure and testing between the implementations of Maybe
and Result
.
Requirements
Maybe
update to date before pulling Results
.Issue: Currently, Maybe and Result are implemented using abstract classes. This adds complexity and execution overhead compared to structs.
Requirements:
Issue: The unit test projects current target .NET 7.0. Since there is actual no need for .NET 7.0, switching to .NET 6.0 (the long-term support version) carries less risk.
Requirements
Issue: The name Maybe
feels more like Haskell than C#.
Requirements:
Maybe
to Option
.Issue: The Maybe<T>
testing contains lots of redundant code and some questionable organization. Three issues in particular need resolution:
Requirements:
Issue: Some files created from templates have CRLF line endings even though they were created on linux (looking at you DocFx).
Requirements
Issue: In order to use property init
, System.Runtime.CompilerServices.IsExternalInit
must be defined. Since the single use of init
can be easily replaced with private set
, the IsExternalInit
hack is not very beneficial.
Requirements
IsExternalInit
.init
instances with private set
.Issue: None<T>
singletons are currently implement as the only member of the Option<T>
class. This is clunky for several reasons:
Option<T>
, but is actually implemented in None<T>
.Requirements:
Option<T>
class.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.