Hi,
  I'm developing toy application to learn HDBC. I have "problem" with
doing relations mapping. Actually I don't know is it a problem or
"feature". ;)

Anyway, I have two tables with relation between them:

(this example is simplified to the whole structure of database, you can imagine)

CREATE TABLE TD_set (
         setId INTEGER PRIMARY KEY,
         setName TEXT NOT NULL
         )

CREATE TABLE TO_card (
         cardId INTEGER PRIMARY KEY AUTOINCREMENT,
         setId INTEGER NOT NULL,"                       -- Relation to TD_set
         setSeq INTEGER NOT NULL
         )

(no foreign key as sqlite3 does not care anyway - at least AFAIK)

And in Haskell:

> type CardSet = String
>
> data Card = Card {
>    set             :: CardSet,
>    seqNo        :: Integer,
> }

There is no problem with filling the structure Card with "seqNo" but I
can't fill "set". I would have to put there IO (CardSet) but I don't
want to do that as whole structure returned from my mapping function
is already inside IO monad. Can I do it?

Here is my (perfect) function - http://hpaste.org/5839 . See
"getCards" and some helper functions. This does not compile as (I
believe) getElement wants to return IO (CardSet)

Thank you in advance for all your input.
Radek.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to