Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-25 Thread Paul Johnson
Stefan O'Rear wrote: On Sat, Mar 24, 2007 at 08:05:25PM +, Paul Johnson wrote: strings, are instances of the Monoid class (i.e. they implement mplus in the way you would expect). You just have to wrap a function around Actually they don't. [EMAIL PROTECTED]:/tmp$ ghc-6.4.2 -v0 -

Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Udo Stenzel
Leandro Penz wrote: > buildStuff = > func1 ++ func2 ++ func3 ++ func4 > > My idea is to have a monad with a concatenating >>, so that I can: > > bulidStuff = do > func1 > func2 > func3 > func4 buildStuff = concat [ func1, func2, func3, func4 ] Remember,

Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Stefan O'Rear
On Sat, Mar 24, 2007 at 08:05:25PM +, Paul Johnson wrote: > strings, are instances of the Monoid class (i.e. they implement mplus in > the way you would expect). You just have to wrap a function around Actually they don't. [EMAIL PROTECTED]:/tmp$ ghc-6.4.2 -v0 -e 'main' X.hs ABend [EMAIL P

Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Paul Johnson
Leandro Penz wrote: I have some functions that build big strings by calling other functions and appending the result, like buildStuff = func1 ++ func2 ++ func3 ++ func4 The usual idiom is something like buildStuff = concat [func1, func2, func3, func4] Put the list elements on separate li

Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Bryan Burgers
My idea is to have a monad with a concatenating >>, so that I can: bulidStuff = do func1 func2 func3 func4 Leandro Penz I actually did this recently for a project I have been working on. First, an example: output label a@(I.Add a1 a2 a3) = do comment (show a) mov' label eax a1

Re: [Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Bryan O'Sullivan
Leandro Penz wrote: My idea is to have a monad with a concatenating >>, so that I can: bulidStuff = do func1 func2 func3 func4 You could do this, but it's easier to take advantage of the fact that [] is an instance of MonadPlus, and just use `mplus`. http://www.haskell.org/

[Haskell-cafe] newbie "concatenating" monad question

2007-03-24 Thread Leandro Penz
Hi I'm new here and this is my first mail to the list, so be gentle :) I have some functions that build big strings by calling other functions and appending the result, like buildStuff = func1 ++ func2 ++ func3 ++ func4 My idea is to have a monad with a concatenating >>, so that I can: bulid