
From: Manuel Gómez
On Sun, Dec 14, 2014 at 12:04 PM, Kei Hibino
wrote: I am happy to announce relational-record library and its project page.
relational-record is domain specific language for type-safe SQL query building, and database access API with compile time schema generators.
Congratulations on the release! It’s great to see more and more interesting abstractions for relational databases in the Haskell ecosystem.
It looks like this project shares many goals with Tom Ellis’ excellent and recently released[1] Opaleye library. How would you say your approach compares with Opaleye’s?
[1]:
Relational Record and Opaleye resembles in approach of building not aggregated SQL query. Opaleye's method using arrow notation is very cool. So I try thin wrapper using Kleisli arrow. https://gist.github.com/khibino/57405584b168d98fd1e8 If not arrow version is like below,
personAndJoin :: QuerySimple (Projection Flat (Person, Birthday)) personAndJoin = do p <- query person b <- query birthday wheres $ p ! Person.name' .=. b ! Birthday.name' return $ p >< b
Arrow version is like this with this wrapper.
personAndJoinA :: QuerySimple () (Projection Flat (Person, Birthday)) personAndJoinA = proc () -> do p <- query -< person b <- query -< birthday wheres -< p ! Person.name' .=. b ! Birthday.name' returnA -< p >< b
Aggregation approaches differ. Relational Record accumulates aggregated context into monad stack, and Opaleye does not. Relational Record basically accumulates various query state into monad stack like join product, group keys and ordering.