project-m36 icon indicating copy to clipboard operation
project-m36 copied to clipboard

Add Haskell types which map statically to tuples

Open agentm opened this issue 8 years ago • 5 comments

As a sort of ORM-lite, it would be handy to be able to push lots of db client type errors to compile time from run time. A good example of how to accomplish this is via https://github.com/Gabriel439/Haskell-Bears-Library.

However, the approach there makes several assumptions about the relational algebra which do not necessarily hold. For example, all relvars have exactly one key; this the deprecated notion of a "primary" key.

Some Template Haskell may be involved here.

agentm avatar Feb 23 '17 02:02 agentm

I should move this issue up in priority.

agentm avatar Mar 16 '17 19:03 agentm

This would be very handy!

3noch avatar May 17 '17 21:05 3noch

Is this effectively a suggestion for adding a typed interface? I have started working on something similar myself, probably using generics-sop. I am coming to project-m36 from the context of acid-state, where every query I made was fully type-checked at compile time, and I not willing to drop type safety in order to use project-m36.

matchwood avatar Jun 11 '18 11:06 matchwood

Yes, you can see more discussion about this in #42.

I certainly understand your hesitation coming from a statically-typed interface and we are examining the options to have our own such interface with some unique features such as schema validation (using a hash of the schema) and support for nested relations (hopefully).

agentm avatar Jun 11 '18 17:06 agentm

Ok, I will comment #42. Schema validation (if I understand you correctly) would be awesome!

matchwood avatar Jun 11 '18 22:06 matchwood