[Haskell-cafe] extending Do notation
Tillmann Rendel
rendel at informatik.uni-marburg.de
Tue May 20 17:05:21 UTC 2014
Hi,
silvio wrote:
> 4) res <- fmap pureFunction ioFunction === let res = pureFunction {
> ioFunction}
I think this translation is wrong. The left-hand side executes the
side-effects of the ioFunction exactly once. The right-hand side looks
like it would execute the side-effects of ioFunction everytime res is used.
Maybe you want something more like this:
res <- pureFunction { ioFunction }
which would desugar to something like this:
res <- do temp <- ioFunction
return (pureFunction temp)
Can you write desugaring rules that explain how your { ... } notation
would work?
Tillmann
More information about the Haskell-Cafe
mailing list