3 ms·
I implemented a newtype [1] system in C#. It's (obviously) not as robust as Haskell (relies on some runtime checks), and isn't as efficient (reflection and box
by louthy 10y ago
I implemented a newtype [1] system in C#. It's (obviously) not as robust as Haskell (relies on some runtime checks), and isn't as efficient (reflection and boxing for value types). But if type-safety is what you want, it's definitely an improvement over passing integers, strings, or other basic types around.
[1] Implementation - https://github.com/louthy/language-ext/blob/master/LanguageExt.Core/NewType.cs https://github.com/louthy/language-ext/blob/master/LanguageE...
[2] Unit tests / examples - https://github.com/louthy/language-ext/blob/master/LanguageExt.Tests/NewTypeTests.cs https://github.com/louthy/language-ext/blob/master/LanguageE...
[3] The request that led to the feature - https://github.com/louthy/language-ext/issues/95 https://github.com/louthy/language-ext/issues/95