Hi Tomek!

> In a CGI application I was gathering SQL statements I wanted to run in
> the final transaction. Because I use haskelldb, it was most convenient
> to use (Database -> IO ()) as the type of the statement or a group of
> statements. In this representation concatenating two statement groups so
> they are executed in sequence can be done with:
>
>     concatStmts s1 s2 = \db -> s1 db >> s2 db
>
> My mistake was that I forgot about db and wrote:
>
>     concatStmts s1 s2 = s1 >> s2
>
> And it was accepted because I had the Monad instance for ((->) r) in
> scope (from Control.Monad.Trans I guess)!

Have you considered changing the statements to have type 'ReaderT Database
IO ()'? Then (>>) actually does what you want.


Pozdrawiam,

Arie


-- 

Always go along with the group, or someone may drop a sixteen-ton safe on
you.
  - The Buddy Bears


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to