Sebastian Fischer wrote:
I am interested in the mentioned laws because I want to show the monad
laws for the definition
instance Monad FreeMonoid where
return x = FreeMonoid ($x)
a >>= f = a >>- f
This definition of `>>=` is *not* the usual one for continuation monads,
but if the mentioned properties hold, I think it also satisfies the
monad laws.
Yes, it does satisfy the monad laws because FreeMonoid is the "free
algebra functor" T for monoids as a T-algebra. In other words, a type
A is a monoid exactly when there is a map T A -> A . I've learned
this idea from Dan Piponi:
http://blog.sigfpe.com/2007/02/monads-for-vector-spaces-probability.html
http://blog.sigfpe.com/2007/06/monads-from-algebra-and-the-gray-code.html
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell