[Haskell-cafe] A convenient way to deal with conditional function
composition?
Stefan O'Rear
stefanor at cox.net
Tue Apr 10 10:11:22 EDT 2007
On Tue, Apr 10, 2007 at 02:33:41PM +0100, Chris Kuklewicz wrote:
> Well, since ((.) :: ShowS -> ShowS -> ShowS) is a Monoid, you can use Writer to
> create the result:
Not portably.
stefan at stefans:~$ ghc-6.4.2 -e '( ("foo"++) `Data.Monoid.mappend` ("bar"++) ) "END"'
"foobarEND"
stefan at stefans:~$ ghc-6.6 -e '( ("foo"++) `Data.Monoid.mappend` ("bar"++) ) "END"'
"fooENDbarEND"
-- 6.6 sources
instance Monoid b => Monoid (a -> b) where
mempty _ = mempty
mappend f g x = f x `mappend` g x
Stefan
More information about the Haskell-Cafe
mailing list