3 ms·
Yep, Linq could be replaced by the more general Computation Expressions in F#
by pharmakom 3y ago
Yep, Linq could be replaced by the more general Computation Expressions in F#
- WorldMaker 3y agoF# has a query { } expression for LINQ already.
- pharmakom 3y agoI'm talking about improving C# by replacing LINQ with the more general Computation Expressions.
- WorldMaker 3y agoAh. The C# compiler "duck types" LINQ so you can already (ab)use LINQ for general computation in C#. You can use nearly any Monad you want with LINQ syntax. It isn't always a strong fit for some types of Monads, but it is more capable than it seems. You might get some funny looks if you do, though. (Similar with async/await: it is "duck typed" at compile time so you can write other Monads for that, if they make more sense in that form of transformer than LINQ. Or support both LINQ and async/await together.) There's definitely some more interesting power in F#'s Computation Expressions that can't easily be done even with (ab)using the tools that already exist like that, but it is still interesting what can be done with the existing tools.
- pharmakom 3y agoI don't think that LINQ has support for appicatives or custom operators. Although yes, it can be abused in impressive ways :)