Comments (3)
The intended use is so decision logic (has value, doesn't have value) can be used in a LINQ join for example. AsEnumerable could be useful in a lazy stream situation, where it's essentially a switch enabling or disabling the stream. AsEnumerableOne is essentially a direct conversion of the Option monad into an IEnumerable monad. So it's purely a type conversion really.
I agree that both are not needed, AsEnumerable().Take(1) = AsEnumberableOne(). It's purely for convenience.
Happy to take further feedback on this.
from language-ext.
Ok, that's more or less what I thought.
Regarding further feedback, as you said AsEnumerableOne is the direct type conversion into the IEnumerable monad, so consider renaming this AsEnumerable. What you're currently calling AsEnumerable is actually a type conversion + repeating that value forever, so consider renaming this one to have the additional suffix: AsEnumerableRepeated, if not removing it entirely.
I don't do enough functional programming to have a sense for how often the lazy stream switch situation comes up, but it sounds like something I've seen done with IObservable (System.Reactive.Linq). There is already a conversion from IEnumerable to IObservable (AsObservable), and there is already a Repeat method which makes it infinite, so the convenience seems minimal vs. just composing two existing functions.
Weighing the convenience vs. how frequent this situation comes up vs. the added confusion of having two conversions into the IEnumerable monad, etc seems warranted.
from language-ext.
Thanks for the feedback @brandf - I think you're right, and have made the necessary modifications.
from language-ext.
Related Issues (20)
- Is it worth adding a ToHashMap that takes Key and Value mappers HOT 2
- Unity iOS build: Constructor not found for type LanguageExt.IntegerRange HOT 3
- README file
- EitherUnsafe MapLeft throws ResultIsNullException HOT 4
- LanguageExt.Fin fails to serialise using Newtonsoft.Json
- CancellationTokenSource not disposed HOT 1
- Stack overflow with MapT on T<Seq> HOT 1
- Proposal: Make .Left/.Right public for Either<> HOT 2
- NewType does not display the derived class that is throwing the error HOT 1
- BindLeftAsync and MapLeftAsync HOT 2
- Pattern Matching [Maybe] Issue with Aff HOT 4
- broken codegen HOT 3
- TryOptionAsync incorrect nullablity HOT 4
- Document using code generation with unity HOT 3
- Applicative Functor HOT 4
- Fin<T> and Fails(): unexpected results HOT 3
- Lenses and EF Core incompatibility HOT 1
- Applicative validation HOT 1
- How to use Fin with sync and async method calls HOT 2
- How to iterate over a list of strings and execute a method for each string as long as an error occurs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from language-ext.