[Haskell-cafe] Re: Haskell-cafe] Serialization of (a -> b) and IO a

John Lato jwlato at gmail.com
Fri Nov 12 05:05:34 EST 2010


>
> Message: 3
> Date: Thu, 11 Nov 2010 18:56:00 +0100
> From: Sjoerd Visscher <sjoerd at w3future.com>
>
> On Nov 11, 2010, at 6:34 PM, John Lato wrote:
>
> > I don't know to what extent it would apply in this hypothetical
> situation, but ghc (and probably other compilers) rely upon Haskell's
> semantics in performing various code transformations.  If you break the
> semantics some transformations become invalid, resulting in incorrect code.
> >
> > I've experienced this with code that violated ref. transparency.  The
> program behavior changed depending on the compiler's optimization settings.
>  I'm not keen to go back to that.
>
> Then don't do that. Being able to serialize functions is just as dangerous
> as having unsafePerformIO. If you don't use it, you don't have problems.
>

If you do use "serialize", I think it would cause problems most of the time.
 A pure serialization would violate referential transparency.  GHC relies
upon referential transparency for some transformations to be valid.
 Therefore it's not possible to use a pure serialization function safely
unless the user can guarantee that it's only used in a referentially
transparent manner, which is an extremely high barrier IMO (higher than for
unsafePerformIO).

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101112/911c1998/attachment.html


More information about the Haskell-Cafe mailing list