Wow. Just ran into this monadic library on github: https://github.com/louthy/csharp-monad. What is crazy is that it seems like operators, like "+" just work. Could we use this to solve our monad hell issues??
seen from United States
seen from Germany
seen from Argentina

seen from Malaysia
seen from Spain
seen from Türkiye
seen from United States

seen from Malaysia
seen from China
seen from United States
seen from United States
seen from United States

seen from Colombia
seen from United Kingdom
seen from Indonesia

seen from United States
seen from Spain

seen from Portugal

seen from Malaysia
seen from United States
Wow. Just ran into this monadic library on github: https://github.com/louthy/csharp-monad. What is crazy is that it seems like operators, like "+" just work. Could we use this to solve our monad hell issues??

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Time to go to the next level with these function generators in the LINQ project. The point is to reduce the number of lines of code - so code isn't always repeated.
This is a major refactor of the code that generates the functions, and will probably take some effort. Unfortunately. The idea is that the QM function will now be much smarter - and generate return statements, etc. This way, I hope, the code that is unique to the function header and trailer can be hidden in the QM function object, rather than making a huge mess in the QueryModelVisitor - which is what it was growing to do.
Wish me luck!
PlotLingo is getting mature enough that when I had a good idea today it took quite a bit of effort to implement, with little immediate gain to the language!
Methods that extend the language can now have IExpression arguments (or anything the inherits from them), and the method matching will proceed properly. This means that the "user" can write any function they want that takes an IExpression and they will get the argument before it has been evaluated.
This also turns out to be a more natural way to code up statement blocks, which are already implemented (e.g. for and map).
However, this meant having to move away from the .NET argument matching and implementing some of my own. Getting that implementation correct and complete was not a very happy process.
And there was one trick I discovered: IsAssignableFrom, a great utility method, does not work when an implicit conversation is involved. For example, it is not possible to cast an Int32 to a double, but there is a cast. And while .NET and the GetMethod method on a type knows about this, it looks pretty hard to implement on your own. So any argument matching has to be a mix of my special code and in the end rely on the GetMethod code to do the final match and take casting into account.
And we have another bug! Wooo! This one seems to be some sort of combination bug.
This
 seems to be a code combination bug, actually. Looking at the code generated by the gist. The first guy that is filled is protected by a bool that is never set to true - or touched, even. Whereas the second one is. So it is as if the code lifting (or whatever the operation) just didn't work. So lets shut that off one by one to see if there is a cause.
Turning off the statement optimizer does nothing for this.
Either query on its own works just fine.
So this is an issue with combining statements - they aren't being combined correctly. Next question: which ones are failing to combine? Why? :-)
If I had to guess, I would have said the ordering wasn't working b.c. that is what we messed with most recently. And it looks like somehow the name propagation didn't go correctly there. So lets see what tests we have for that...
A test to reproduce it (though with lots of garbage at the same time): TestSortCombineNoFunctionMissRename.
The bug was in the TryCombine method of the StatementLoopOverSortedPair object. When I added in arbitrary things to record, I'd forgotten in the rename to rename the index variable and I'd forgotten to combine the @&#@ blocks (duh)! The file change history helped make that right quick. A little surprised this didn't show up in other tests!
So, lets take a look at this to see what is going on (or isn't):
This was a run of QCDCorrelationPlots with IgnoreQuery set to true. So everything!
Looking for aDictionary_2_48964Map.
I can see it being filled with a push_back
But I never see it getting declared. Ever!!!
Ok, so this is a "different" problem - somehow the declaration is getting lost. And so lost that it is never emitted. We know, however, that it is always declared. So this means it is something in the statement optimizer?
Ha! The problem was I never ever declared the darn dicts for the other variables that were being saved. Added test and updated.
Of course,still crash. :( And it is basically the same mistake. I guess we don't have any dual IRefQuery in the compile part of our tests. That should probably get added...
That is fixed. And it compiles! However, there was a stack overflow exception... No clue where that happened (not much of a stack dump). But that means this bug here is "done".

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
So close!!! It is a lot better, but...
Info in <TWinNTSystem::ACLiC>: creating shared library C:\Users\Gordon\AppData\L ocal\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\query0_cxx.dll 2900861_cint.cxx query0_cxx_ACLiC_dict.cxx C:\Users\Gordon\AppData\Local\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\ query0.cxx(18097) : error C2065: 'aDictionary_2_48964Map' : undeclared identifie r C:\Users\Gordon\AppData\Local\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\ query0.cxx(18097) : error C2228: left of '.push_back' must have class/struct/uni on C:\Users\Gordon\AppData\Local\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\ query0.cxx(18110) : error C2065: 'aDictionary_2_48964Map' : undeclared identifie r C:\Users\Gordon\AppData\Local\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\ query0.cxx(18110) : error C2065: 'aDouble___48967' : undeclared identifier C:\Users\Gordon\AppData\Local\Temp\LINQToTTree\QCDCorrelationStudy\4kq2ztje.q4m\ query0.cxx(18110) : fatal error C1903: unable to recover from previous error(s); Â stopping compilation Error in <ACLiC>: Compilation failed!
Getting to the bottom of this - perhaps FirstLast already has a solution for us? We've had to do this once there. The basic algorithm is as follows:
Start a the current scope, and walk back up until we hit the result scope. At each statement level...
Continue only if this guy is a StatementLoop of some sort
Look at all the loop index variables that that statement has
See if anything was referenced in that is in the current loop index variable.
So - would that work for us? I'm worried not - because for us the reference takes place outside the current stack crawl. At any rate, a new saver is added for anything that satisfies that.
Lets extract that code and see if it can't be used again.
The code extracted, and lo, it seems to grab the variable we need, and stuff it into a dictionary. Very sweet! Now we just need to properly propagate it and we will be ok. I am amazed it works!
Wow - it more than works - it seems to be generating reasonable code, even code that is basically correct! Sweet. However, I destroyed a number of things having to do with statement recombination, etc. :-)
Check:
anything that saves values probably needs a way to cache more than a single item. So, what about the group-by operator?
I have a nifty "Return<>()" for an enumerable which will take any single object and make an enumerable sequence of 1 out of it, rather than having to do the new T[] { obj}. We should fix up our code wherever that patter is.
How to fix this double sort bug: We need to cache more information, unfortunately.
Line #19 is the problem here:
  We are only recording one thing there - we need to also be recording the aInt_10 value, and then re-using that below. This is unfortunate, not totally sure how we will make that work!