[Haskell-cafe] newbie "concatenating" monad question

Stefan O'Rear stefanor at cox.net
Sat Mar 24 16:20:28 EDT 2007


On Sat, Mar 24, 2007 at 08:05:25PM +0000, 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.

stefan at stefans:/tmp$ ghc-6.4.2 -v0 -e 'main' X.hs
ABend
stefan at stefans:/tmp$ ghc-6.6 -v0 -e 'main' X.hs
AendBend
stefan at stefans:/tmp$ cat X.hs
import Data.Monoid
main = putStrLn $ (str1 `mappend` str2) "end"
str1 = ("A" ++)
str2 = ("B" ++)
stefan at stefans:/tmp$

Stefan


More information about the Haskell-Cafe mailing list