[Haskell-cafe] Converting IO [XmlTree] to [XmlTree]
lrpalmer at gmail.com
Tue Apr 14 11:42:57 EDT 2009
On Tue, Apr 14, 2009 at 9:24 AM, Cristiano Paris <frodo at theshire.org> wrote:
> On Tue, Apr 14, 2009 at 5:09 PM, Luke Palmer <lrpalmer at gmail.com> wrote:
> > ...
> > Please don't say that. He's a beginner.
> > You realize that the path of least resistance will be to use it, right?
> > You see why that's not a good thing?
> > Even experts don't use this function.
> > (To the O.P.: don't use it)
> Mmmh, sorry Luke but I don't understand this ostracism.
> unsafePerformIO is not "evil" by itself, it's there for a purpose and,
> as for anything else in the language, it's better to understand when
> to use it and when not rather than just knowing that is something that
> MUST not be used, without any further explanation.
You have a point. I would like to avoid introducing unfounded authoritarian
stigmas whenever possible.
However, the way I see it is that unsafePerformIO *is* evil by itself, and
it is only by the addition of Holy Water that it is benign to use.
Ryan Ingram described it as a way to achieve "RTS extensions", which I think
is a fine way to put it I consider Debug.Trace to be an instance of this:
we are extending the RTS to provide execution traces.
I guess it's a teaching style thing. Mostly, if someone sees "I have an IO
[XmlTree] and I need an [XmlTree]", I want the "I'm asking the wrong
question" synapse path to fire, rather than the "just use unsafePerformIO"
> More, from my personal experience, knowing unsafePerformIO helped me
> understand better what Monads are and how they should be used.
> I wounder what so-called "experts" have to say about this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe