On Feb 16, 2010, at 2:11 PM, Stephen Tetley wrote:

Your monad looks equivalent to the Identity monad but over a much
bigger syntax. What advantages do you get from it being a monad,
rather than just a functor?


I replied to Stephen, but forgot to include the list. I took the liberty of making some changes.

I mostly use this construct functorially. Defining a monad instance can be done in O(n) lines, but an applicative functor instance needs O(n^2) lines, where n is the number of type constructors. The monadic structure doesn't interfere with the semantics I want, so I went with that.

As you said, this is basically an identity monad, but it's not too hard to turn it into a sequencing monad. For example, instead of defining (NestViews l m r) >>= f as (NestViews (l >>= f) (m >>= f) (r >>= f)), we can do it in terms of arbitrary constructors, as long as >>= induced a partial order. This approach has some interesting potential.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to