3 ms·
Scala doesn't have anything like this where the query is compiled monadically before execution, although the data structures do expose excellent ways to chain f
by duaneb 10y ago
Scala doesn't have anything like this where the query is compiled monadically before execution, although the data structures do expose excellent ways to chain functional combinators. Squeryl (and there's a similar competitor) implement this for SQL, and I'd say it's 80% there--still a lot of rough edges fitting dynamic queries (e.g. number of tables joinable in a single statement) into a static language.
- rm999 10y agoWould Catalyst in Spark SQL count? http://people.csail.mit.edu/matei/papers/2015/sigmod_spark_sql.pdf http://people.csail.mit.edu/matei/papers/2015/sigmod_spark_s...
- virtualwhys 10y ago> Scala doesn't have anything like this where the query is compiled monadically before execution Nonsense, Scala is arguably leading the way in the statically typed composable query dsl department; see Slick [1] and Quill [2] among others. Outside of Haskell's Esqueleto I am not aware of any statically typed query dsl that comes remotely close to the aforementioned. LINQ to SQL/Objects provides static query generation but doesn't compose; beyond that, what is there? [1] https://github.com/slick/slick https://github.com/slick/slick [2] https://github.com/getquill/quill https://github.com/getquill/quill
- Arnavion 10y ago>LINQ to SQL/Objects provides static query generation but doesn't compose How do you mean? The result of a LINQ query is a sequence that can be used as the input of another LINQ query.
- virtualwhys 10y agoBy LINQ query I mean LINQ to SQL, not the basic LINQ collections functionality (the equivalent in Scala being for comprehensions, BTW). If you have an example of .NET based query composition to share I'd like to see it; last I checked there was no such functionality available.
- MichaelGG 10y agoLINQ to SQL ends up creating an expression on IQueryable. You can build this expression up any way you want, including in bits and pieces. You can tack on Wheres and Selects any time you like. It's more composable than pain text SQL since the parts can go in any order. It's only after you force it to materialize (I.e. call ToList) that you can't further "compose" it.
- deleted 10y ago[deleted]
- tome 10y ago* https://github.com/tomjaguarpaw/haskell-opaleye https://github.com/tomjaguarpaw/haskell-opaleye * https://github.com/khibino/haskell-relational-record https://github.com/khibino/haskell-relational-record
- rubyfan 10y agoThe Scala package Circumflex ORM had such a feature ~6 years ago. It had some problems here and there but was interesting to write SQL as native Scala. http://circumflex.ru/projects/orm/index.html http://circumflex.ru/projects/orm/index.html