[Haskell] Re: Announce: revamped free theorems generator
Heinrich Apfelmus
apfelmus at quantentunnel.de
Wed Jun 23 06:32:42 EDT 2010
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
More information about the Haskell
mailing list