
20 May
2014
20 May
'14
1:05 p.m.
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