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