Hacker News new | past | comments | ask | show | jobs | submit login

PRQL is cool, except I liked it better when it was called LINQ.



I keep hearing LINQ is the best, Can anyone explain how its better than say prisma?


LINQ is neat because it maps from the C# IEnumerable API to SQL. So you use the same methods to work with in-memory collections as you do database tables, which leads to a very natural feeling programmer experience. Compare to Rails' Active record where `things.where(foo: 6)` calls out to the database but `things.filter { |t| t.foo == 6 }` will pull all the things into memory and then iterate through them to create the filtered list. In LINQ those are both `things.Where(t => t.foo == 6)` and the type of "things" determines where the query executes.


This needs language / introspection support when converting to SQL as you need to pick apart the expression's AST to figure out that it's eg. a simple equals check on one of the fields.


Well one of the things that makes it neat is that it works for any Monad. Where Monad means any implementation of the following method

    F<Y> SelectMany(F<X> input, Func<X, F<Y>> map)
this could be a function where you have a list of things, apply a function to each element that returns a list and the result is the concatenation of the individual lists. Or you could use it for stuff like tasks where the result is a task that returns something like `await map(await input)`.


So LINQ that can be used with languages other than C#?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: