
4 Dec
2009
4 Dec
'09
2:29 p.m.
On Fri, Dec 4, 2009 at 1:14 PM, Jason McCarty
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