
At Thu, 22 May 2008 01:04:24 +0200, Marc Weber wrote:
Some way representing relational data which is typically stored in databases such as Postgresql..
Rewriting something like Postgresql in haskell would take ages.. So I'd be satisfied with having in memory representation only (this would fit the HAppS state system very well .. :)
Are you familiar with the HAppS IxSet library? You would do something like: $( deriveAll [''Ord,''Eq,''Read,''Show,''Default] [d| data CD = CD AlbumTitle Artist [Track] newtype Artist = Artist String newtype AlbumTitle = AlbumTitle String data Track = Track TrackTitle TrackIndex newtype TrackIndex = TrackIndex Int newtype TrackTitle = TrackTitle String |]) $(inferIxSet "CDS" 'noCalcs [''AlbumTitle, ''TrackTitle, ''Artist]) This creates a table with indexs on AlbumTitle, TrackTitle, and Artist. You can do a simple query like: mycds @= (Artist "Wesley Willis") to get all the tracks by Wesley Willis. You should be able to build joins, etc on top of that. j.