Thanks for the explanation on free monads, it's interesting. But still, I maintain my previous view. I could clarify that by saying that (e.g. for Maybe) we could separate it in two types, Maybe itself and its monad:
-- The plain Maybe type data Maybe a = Just a | Nothing -- The MaybeMonad newtype MaybeMonad a = MM ( () -> Maybe a ) That's what using Maybe as a monad semantically means, doesn't it? It's just that as I said before, the function () -> Maybe a is useless, thus making the whole type MaybeMonad entirely equivalent to Maybe. So Roman, as I understand it, a free monad can only be a stateless monad. So *again*, FreeM is equivalent to : data FreeM f a = Return a | Bind (* () ->* f (FreeM f a) ) You cannot express StateT for instance with a functor and FreeM, can you? But if you change FreeM to be: data FreeM f s a = Return a | Bind (* s ->* f (FreeM f a) ) Then maybe it becomes possible... 2011/12/31 Roman Cheplyaka <r...@ro-che.info> > * Yves Parès <limestrael+hask...@gmail.com> [2011-12-31 13:09:37+0100] > > One thought occur to me recently when explaining the concept of Monad to > > non-haskellers: internally, all standard Monads are newtypes wrapping > > functions: > > StateT is, WriterT is, ContT is. Even IO and ST are, both conceptually > and > > in their implementation by GHC. > > ParsecT (not part of mtl, but still) is. And so on... > > Writer(T) is not a function, it's just a tuple. > > Jerzy already mentioned [] and Maybe. > > Another example is a free monad generated by any polynomial functor. > This subsumes Maybe and (almost) [], as described here: > http://blog.omega-prime.coRoman.uk/?p=34<http://blog.omega-prime.co.uk/?p=34> > > To summarise, since there are only so many ways to form types in Haskell > (sum, product and exponentiation (functions)), it's no surprise that > functions do occur often, but that's not something fundamental to monads. > > -- > Roman I. Cheplyaka :: http://ro-che.info/ > -- The ⊥ is a lie.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe