haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] Re: a regressive view of support for imperative progr

Subject: Re: [Haskell-cafe] Re: a regressive view of support for imperative programming in Haskell
From: Stefan O'Rear
Date: Mon, 13 Aug 2007 07:50:30 -0700
On Mon, Aug 13, 2007 at 04:35:12PM +0200, apfelmus wrote:
> My assumption is that we have an equivalence
>
>   forall a,b . m (a -> m b) ~ (a -> m b)
>
> because any side effect executed by the extra m on the outside can well be 
> delayed until we are supplied a value a. Well, at least when all arguments 
> are fully applied, for some notion of "fully applied"


(\a x -> a >>= ($ x)) ((\f -> return f) X) ==> (Î)
(\a x -> a >>= ($ x)) (return X)           ==> (Î)
(\x -> (return X) >>= ($ x))               ==> (monad law)
(\x -> ($ x) X)                            ==> (Î on the sugar-hidden 'flip')
(\x -> X x)                                ==> (Î)
X

Up to subtle strictness bugs arising from my use of Î :), you're safe.

Stefan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
<Prev in Thread] Current Thread [Next in Thread>