Error-accumulating composable assertions in C#

2022-12-19

This article is about composing non-short-circuiting assertions in C# in such a way that failure messages accumulate. It explores a simpler API than the previous articles proof of concept, using a NotEmptyCollection collection to encapsulate knowledge that a collection is never empty. The article explains the advantages of encapsulating such knowledge in the type itself and provides code examples to illustrate its implementation. It concludes with a suggestion that perhaps the list monoid is all thats needed for non-short-circuiting assertions.

Link [ https://blog.ploeh.dk/2022/12/19/error-accumulating-composable-assertions-in-c/ ]

Previous Article

Error-accumulating composable assertions in C#

2022-12-19

This article is about composing non-short-circuiting assertions in C# in such a way that failure messages accumulate. It explores a simpler API than the previous articles proof of concept, using a NotEmptyCollection collection to encapsulate knowledge that a collection is never empty. The article explains the advantages of encapsulating such knowledge in the type itself and provides code examples to illustrate its implementation. It concludes with a suggestion that perhaps the list monoid is all thats needed for non-short-circuiting assertions.

Link [ https://blog.ploeh.dk/2022/12/19/error-accumulating-composable-assertions-in-c/ ]

Copyright © 2024 All rights reserved

Rss

Atom