[Haskell-cafe] Re: [Haskell] Re: Global Variables and
IO initializers
Peter Simons
simons at cryp.to
Mon Nov 8 06:58:42 EST 2004
Adrian Hey writes:
> Perhaps you would like to show me your solution to the
> "oneShot" problem.
I don't see any value in problems that are specifically
designed so that they can be solved only with a global
entity. What is the real-world application for oneShot?
> If this is such a wacky idea then why is the use of the
> unsafePerformIO hack to do precisely this so common place?
Because programmers tend to be lazy. I like Haskell because
it doesn't _allow_ me to be lazy.
> I gather it's even used within ghc. If the two Simons
> don't know how to write "proper" Haskell, what hope is
> there for the rest of us.
Nobody said that. Use of unsafePerformIO does not equal bad
code.
> But why would it be a problem if it was not?
Because code like that is very hard to get right and very
hard to maintain, and I don't want to use library code that
uses this technique if I can avoid it.
I'll be readily convinced of the opposite once I see code
that makes good use of this.
Peter
More information about the Haskell-Cafe
mailing list