[Haskell-cafe] newbie "concatenating" monad question

Paul Johnson paul at cogito.org.uk
Sun Mar 25 10:25:55 EDT 2007


Stefan O'Rear wrote:
> 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" ++)
>
>   

Does this mean that the semantics have changed?  If so, which one is 
correct?

Paul


More information about the Haskell-Cafe mailing list