[Haskell-cafe] Inverse of HaskellDB
ozgurakgun at gmail.com
Wed Sep 29 06:01:25 EDT 2010
OK, I am rephrasing it a bit then :)
I definitely don't think this would be trivial to implement. However, I'd
expect a decent solution to this problem, not to have special combinators to
describe relations between data types, but let the user model their data
using plain haskell data types, and infer the associated table structure
just by looking at the data types.
I'll give this a harder thought once I find the time. There is the huge
barrier of TH, stopping me from playing with things like this.
Anyway, have fun! :)
On 29 September 2010 10:41, Chris Eidhof <chris at eidhof.nl> wrote:
> On 28 sep 2010, at 17:33, Ozgur Akgun wrote:
> > How do you define relationships between data types?
> > Well, why is it any different from other fields? From one of your
> examples , I'd expect you to have a list of questions in the Quiz data
> type, and if necessary, a quiz field in the Question data type. This might
> be a bit tricky but certainly achievable .
> This is really tricky. For example, consider storing a large tree in the
> > data Tree = Node Int Tree Tree | Leaf Int
> This means you need to read the entire tree from the database. Or consider
> cyclic datastructures (such as the example you gave). How do you store this?
> The only way to inspect this is using a library like data-reify .
> I think the problem might be a bit harder than you suspect.
> Another way to solve it is using Sebastiaan Visser's framework, described
> in his paper , but that's also rather complicated.
> : http://hackage.haskell.org/package/data-reify
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe