5 Dec
2009
5 Dec
'09
3:29 a.m.
On Fri, Dec 4, 2009 at 1:14 PM, Jason McCarty <jmccarty@sent.com> wrote:
wren ng thornton wrote:
concat1 :: T a b -> (b -> T a b) -> T a b
This could just as easily be
concat :: T a b -> (b -> T a c) -> T a c
right? It's a little weird to call this concatenation, but I bet it could come in handy.
T a is, among other things, the free monad for the functor (,) a. The concat you describe is the monadic bind. data T a b = D b | W a (T a b) instance Monad (T a) where return = D D b >>= f = f b W a t >>= f = W a (t >>= f) -- Dave Menendez <dave@zednenem.com> <http://www.eyrie.org/~zednenem/>