Oops -- I wasn't watching this thread. I like Jules's definition, though
I'd write it as follows.
-- Standard instance: monad applied to monoid
instance Monoid a = Monoid (IO a) where
mempty = return mempty
mappend = liftM2 mappend
You can replace IO with any monad at all, to make similar
On Tue, May 15, 2007 at 06:55:11AM -0700, Conal Elliott wrote:
You could also use mappend instead of concatStmts and keep the Database -
IO () representation.- Conal
You mean using the (Monoid b) = Monoid (a - b) instance ?
I can see that IO () makes a perfect Monoid, but there doesn't seem
Tomasz Zielonka wrote:
On Tue, May 15, 2007 at 06:55:11AM -0700, Conal Elliott wrote:
You could also use mappend instead of concatStmts and keep the Database -
IO () representation.- Conal
You mean using the (Monoid b) = Monoid (a - b) instance ?
I can see that IO () makes a
On Wed, May 16, 2007 at 09:28:31AM +0100, Jules Bean wrote:
Tomasz Zielonka wrote:
You mean using the (Monoid b) = Monoid (a - b) instance ?
I can see that IO () makes a perfect Monoid, but there doesn't seem to
be a standard instance for that.
Indeed, all Monads are Monoids (that is, if m
Tomasz Zielonka wrote:
On Wed, May 16, 2007 at 09:28:31AM +0100, Jules Bean wrote:
Tomasz Zielonka wrote:
You mean using the (Monoid b) = Monoid (a - b) instance ?
I can see that IO () makes a perfect Monoid, but there doesn't seem to
be a standard instance for that.
Indeed, all
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
On Tue, May 15, 2007 at 02:27:13PM +0200, Arie Peterson wrote:
Hi Tomek!
Hi!
Have you considered changing the statements to have type 'ReaderT Database
IO ()'? Then () actually does what you want.
I tried it and it made the code simpler, more readable and of course
more immune to this type
You could also use mappend instead of concatStmts and keep the Database -
IO () representation.- Conal
On 5/15/07, Arie Peterson [EMAIL PROTECTED] wrote:
Hi Tomek!
In a CGI application I was gathering SQL statements I wanted to run in
the final transaction. Because I use haskelldb, it
On May 15, 2007, at 14:52 , Tomasz Zielonka wrote:
On Tue, May 15, 2007 at 02:27:13PM +0200, Arie Peterson wrote:
Hi Tomek!
Hi!
Have you considered changing the statements to have type 'ReaderT
Database
IO ()'? Then () actually does what you want.
I tried it and it made the code