[Haskell-cafe] Re: Re: A free monad theorem?

Lennart Augustsson lennart at augustsson.net
Sun Sep 3 09:39:22 EDT 2006


Well, bind is extracting an 'a'.  I clearly see a '\ a -> ...'; it  
getting an 'a' so it can give that to g.  Granted, the extraction is  
very convoluted, but it's there.

	-- Lennart

On Sep 2, 2006, at 19:44 , Udo Stenzel wrote:

> Benjamin Franksen wrote:
>> Sure. Your definition of bind (>>=):
>> ...
>> applies f to something that it has extracted from m, via  
>> deconstructor
>> unpack, namely a. Thus, your bind implementation must know how to  
>> produce
>> an a from its first argument m.
>
> I still have no idea what you're driving at, but could you explain how
> the CPS monad 'extracts' a value from something that's missing  
> something
> that's missing a value (if that makes sense at all)?
>
> For reference (newtype constructor elided for clarity):
>
>> type Cont r a = (a -> r) -> r
>
>> instance Monad (Cont r) where
>> 	return a = \k -> k a
>> 	m >>= g = \k -> m (\a -> g a k)
>
>
>
> Udo.
> -- 
> Streitigkeiten dauerten nie lange, wenn nur eine Seite Unrecht hätte.
> 	-- de la Rochefoucauld
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list