Closed MetaMemoryT closed 10 years ago
What determines the type t3
in your signature there? it only occurs in positive position.
Hmmm, nothing currently, t3
could be anything.
Would an instance of a typeclass be a sensible way to determine the t3
as in:
class Mergeable t1 t2 t3 | t1 t2 -> t3 where
merge :: t1 -> t2 -> t3
innerJoin ::
(Tabular t1
,Tabular t2
,Tabular t3
,Mergeable t1 t2 t3) =>
(t1 -> t2 -> Bool) ->
Table t1 -> Table t2 -> Table t3
I think I never need the primary keys to be the same type anymore.
Then I could use template haskell to derive for each table and joined table I want to conduct inner joins on:
t3
tables for joined table resultsAn instance seems like a pretty brutal way to make the decision. Not sure how the whole thing would come together. If you can bang something out that works, I'd be curious to see it.
I want to define an
innerJoin
between two tables, something like:How could the result
t3
have aTabular
instance automatically derived for it?How could the lenses that are used to manipulate
Table t1
andTable t2
still be able to manipulateTable t3
?