[Haskell-cafe] Re: To yi or not to yi,
is this really the question? A plea for a cooperative,
ubiquitous, distributed integrated development system.
Pasqualino 'Titto' Assini
tittoassini at gmail.com
Thu Jun 21 03:12:00 EDT 2007
Thanks for the explanation.
But, doesn't this simply mean that the correct signature would be:
serialize :: (Int -> Int) -> IO String
to take in account the fact that serialise really use 'external' information
that is not in the domain of pure Haskell functions?
Having "serialize" in the IO monad would do no harm as usually one serialise
precisely to output a value :-)
So, is it correct to conclude that there is no theoretical reason why Haskell
cannot have a built-in reification/serialisation facility?
On Wednesday 20 June 2007 17:05:04 apfelmus wrote:
> Pasqualino 'Titto' Assini wrote:
> > Is there any fundamental reasons why Haskell functions/closures cannot be
> > serialised?
> > I believe that this is precisely what the distributed version of GHC used
> > to do.
> > Most languages, even Java, have a reflection capability to dynamically
> > inspect an object. It is surprising that Haskell doesn't offer it.
> Inspecting functions is not referentially transparent. In Haskell,
> function equality is extensional, i.e. two functions are equal when
> their results are equal on all arguments. Intensional equality would
> mean that functions are equal when they have the same representation. If
> you allow a function
> serialize :: (Int -> Int) -> String
> that can give different results on intensionally different functions,
> you may not expect equations like
> f (*3) == f (\n -> n+n+n)
> to hold anymore (because f might inspect its argument). Also, having
> "serialize" somehow check whether intensionally different arguments are
> extensionally the same and should have a unique serialization is no
> option because this problem is undecidable.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe