[Haskell-cafe] Why?

Luke Palmer lrpalmer at gmail.com
Fri Dec 11 19:47:00 EST 2009


On Fri, Dec 11, 2009 at 4:55 PM, Jason Dusek <jason.dusek at gmail.com> wrote:
> 2009/12/10 Luke Palmer <lrpalmer at gmail.com>:
>> I always meet with armies of resistance when I say this...
>
>  The troops arrive.
>
>> ...but unsafePerformIO should die a horrible, unforgiven
>> death. "Well what if you want blah blah blah with a pure
>> interface?" My response: too fscking bad!
>
>  Wouldn't removing `unsafePerformIO` just force us, in many
>  cases, to write the same thing in C and then import it? Or
>  would you amend the FFI so "math.h sin" could not be imported
>  pure?

This is not the sort of resistance I expected :-).  Naturally my
unrealistic argument applies to FFI as well; sin, if imported from C,
would have to return in an appropriate structure.  Not necessarily IO
(I don't like the idea of a universal sin-bin -- I'd rather introduce
a family of structures with well-defined meanings), but the same idea.
Support for commutative monads (once we understand them) may relieve
some of the pain of this approach.

The idea being that any code that is pure could be evaluated anywhere
with a very simple interpreter.  If you have pure code, you can trace
it back and evaluate it in a sandbox where you don't need a C runtime,
a linker, or really anything but the simplest substitution engine.
*All* effects bubble their way up to the top level, so that we know
from the type signature of a value the machinery we will need to run
it.

Pure functional code as the minimal essence of pure computation --
everything else an EDSL.

Of course I am not talking about Haskell anymore.  Haskell is a firm,
maturing language and has no room for such radical changes.  This
argument applies to an eventual spiritual successor of Haskell (it is
probably too liberal for Haskell' even).

Luke


More information about the Haskell-Cafe mailing list