[Haskell-cafe] \_ -> not equivalent to const $
lrpalmer at gmail.com
Thu Jan 10 18:14:52 EST 2008
On Jan 10, 2008 11:11 PM, Felipe Lessa <felipe.lessa at gmail.com> wrote:
> On Jan 10, 2008 8:54 PM, Luke Palmer <lrpalmer at gmail.com> wrote:
> > Can someone explain what the heck is going on here?
> AFAICT, nothing is wrong. You see, both returned the very same values.
> What you saw was in fact the problem with unsafePerformIO and friends,
> as they may be executed lots of times *or not*. The compiler is free
> to behave in those two ways for the code with const or with the
> lambda. But referential transparency wasn't broken at all =).
Of course. I'm trying to write a variant of cycle that will be efficient
with memory for my purposes, so the Haskell 98 standard, which says nothing
about memory usage, doesn't really interest me. I'm more interested in
what is going on in ghc (6.8.1) in this case, if it has a simple explanation.
And of course am interested if there are any better ways to write such a
More information about the Haskell-Cafe