[Haskell-cafe] Another question about unsafePerformIO

Max Rabkin max.rabkin at gmail.com
Thu Jun 25 09:54:09 EDT 2009


On Thu, Jun 25, 2009 at 3:49 PM, John Meacham<john at repetae.net> wrote:
> However, if the algorithm takes a signifigant amount
> of time or resources, you may want to keep it in IO just so users can
> have control over exactly when and how often it is run.

If you had a pure function written in Haskell that used a lot of time
and memory, would you put it in IO just so users can have control over
exactly when and how often it is run?

bigFatFunction :: Foo -> IO Bar
bigFatFunction x = return . bigFatFunction $ x

If the function really does use a lot of time and memory and your
compiler is duplicating calls to it, then you have a pessimizing
compiler and should file a bug.

--Max


More information about the Haskell-Cafe mailing list