question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi Vladimir, thanks for that great library and your premium stuff on Pluralsight. I was wondering why there is no Extension on Result<T> to convert it to a Maybe<T> like the following:

public static class ResultToMaybeExtensions { public static Maybe<T> ToMaybe<T>(this Result<T> result) { return result.IsFailure ? Maybe<T>.None : Maybe.From(result.Value); } }

Do I misunderstande these two concepts so that this is not a valid use case? For example I would like to offer the value object Address on an Entity Customer as a get-only Maybe. Therefore I would use Address.Create(…) and later in the process I need to transform it to a Maybe monade.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vkhorikovcommented, Nov 16, 2021

Yes, it is planned, just didn’t have time yet to implement it. Feel free to submit a PR.

1reaction
Uli-Armbrustercommented, Nov 5, 2021

Thanks Vladimir for explanation. 👍 I would really enjoy seeing your Pluralsight course EF Core Encapsulation updated to the new possibilities of EF Core 6. ✌️ Maybe I can contribute to or support you with Code Samples

Read more comments on GitHub >

github_iconTop Results From Across the Web

Result to Maybe Conversion - Vladimir Khorikov
Result and Maybe. First off, what are Result and Maybe ? Result is a class that represents a result of an operation.
Read more >
Brief beginners guide to Maybe and Result types in Elm
Two of them are the concepts of Result and Maybe. ... So, to deal with situation that can bring error, there are three...
Read more >
vkhorikov/CSharpFunctionalExtensions: Functional ...
Use case: Procedurally checking if the Maybe has a value, usually before accessing the value directly. void Response(string fruit) { Console.
Read more >
Extensions — csharp-functional-docs 1.0.0 documentation
In the NuGet packages there are extensions that mutate from Maybe monad to Result, Result<T>, Result<TValue,TError>; as well as many others that mutate...
Read more >
Functional C#: Handling failures, input errors
Introducing the Result class helps to show if the method can fail or not. OnSuccess, OnFailure, and OnBoth methods, on the other hand,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found