Comments (9)
Ok, to answer my last question: The correct term seems to be intersection types
.
from compossible.
Well, I called them intersection types in my talk, but that is actually not the entire story, because sub-typing applies as well.
Looking at your code, I don't remember if I tried that, but I doubt the compiler would support something like this where you split up the type. You should be able to do that with (more) macros. Either directly, or by implementing a shapeless LabelledGeneric instance for TMaps as a macro, and then allow you to use shapeless' tooling to recurse over the keys and produce shows for them. There are macros that operate on the sets of keys here: https://github.com/cvogt/compossible/blob/tmp/0.2/src/main/scala/TMap.scala#L125
from compossible.
Ok, I'll try my luck with macros then. Maybe it's even something that can be contributed back to compossible as PR.
from compossible.
sure :)! I want to get back to compossible eventually myself. But my free time is currently occupied by the things I'll talk about at nescala and the typelevel summit.
from compossible.
@nightscape did you also look at https://github.com/scala-records/scala-records/ if compossible is merged, like it may be scala-records/scala-records#112 Scala could have a single good Record library.
I think having defacto Record library would make Scala amazing language, right now I think lack of Record library makes a difference in other frameworks. I know that developer of http://getquill.io/ wanted initially to implement own Record like DSL but thought it would be too much to learn, if Scala had records maybe it would be using it instead.
I really want to have a SQL library with a Record support in it's core, after all SQL is all about records.
from compossible.
@Ciantic I had a look at scala-records and it looks very nice in fact. For my specific use case though a type-indexed map is the perfect fit 👍
from compossible.
@nightscape Another idea: You may be able to implement something like TMap on top of shapeless encoding the included types as an HList, which does allow element-wise extraction.
from compossible.
I thought about that, too. But would that allow me to extract types in arbitrary order?
For type class instances that require more than one parameter from the map I can't guarantee that they were added to the HList in the corresponding order.
from compossible.
if shapeless hlists have some kind of contains operation, it should work. you'd need to ask for each of the parameters separately if they are contained
from compossible.
Related Issues (14)
- Replace Record with implicit conversion macro
- Better set operations HOT 5
- Create Records from tuples
- create records from anonymous classes
- rename fields in records
- write a slick shape to use Record within Slick queries
- more robustness testing
- Review https://github.com/TiarkRompf/virtualization-lms-core/pull/78/files
- Change repo name HOT 1
- Status of this effort? HOT 3
- Open question: How to handle field name clashes when merging records
- No artifacts in Sonatype HOT 1
- Library artifact doesn't resolve 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 compossible.