[Haskell-cafe] Converting IO [XmlTree] to [XmlTree]

Donn Cave donn at avvanta.com
Tue Apr 14 12:43:25 EDT 2009


Quoth Cristiano Paris <frodo at theshire.org>,

> I was a bit surprised by the strong reaction about my citation of
> unsafePerformIO.

Well, there might be a couple of things going on here.  Part of it is
how to guess the unstated context of a question - I'm fairly sure that
given a more thorough presentation of the question, there would have
been no controversy about the answer.  The general problem is that
people who are comfortable with extremely esoteric parts of Haskell
and used to discussing such things here, fail to recognize when they're
dealing with people who are at a point where their needs are much more
basic.  (And who knows, which one was the present case?  Not really
enough information to know absolutely for sure.)

But as you have found, unsafePerformIO is not just an esoteric topic,
it's an uncomfortable one.  We read that it isn't even part of the
language, one should never really have any use for it in computation,
only as a sort of meta-programming RTS thing.  Yet, you might never
guess this from reading the GHC documentation, which only urges you
to be careful.  Or from encountering it in fairly widespread use as
a way to implement top level program state with IORefs.  This sort
of unresolved tension between practice and theory rightly makes people
uneasy, and in my opinion you shouldn't take it personally.  It's a
good thing to occasionally probe those sore spots, and maybe if it
bothers us enough it will lead to improvements.

	Donn



More information about the Haskell-Cafe mailing list