On Fri, Dec 4, 2009 at 1:14 PM, Jason McCarty <jmcca...@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 <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to