[Haskell-cafe] Serialization of (a -> b) and IO a
dan.doel at gmail.com
Fri Nov 12 04:04:21 EST 2010
On Thursday 11 November 2010 9:23:13 pm Luke Palmer wrote:
> Admittedly, the class of reasoning I usually use in my Haskell
> programs, and the one that you talked about using earlier this
> message, is essentially "seq doesn't exist". However, I prefer to use
> this class of reasoning because I would prefer if seq actually didn't
> exist (er, I think the implication goes the other way).
seq can still exist, I think. And I still want it (well, I could leave it for
functions, really, I think). What doesn't exist, loosely speaking, is bottom,
forall x y. x `seq` y = y
And so seq = flip const. That makes things like:
foo ... = ... (x `seq` y) ...
appear useless, unless we remember that denotational semantics aren't the end-
all and be-all, in which case we can recognize that seq is used as an
operational hint to the compiler, same as par and pseq. It just happens to be
the case that in Haskell's ordinary semantics, merely giving the denotational
semantics of seq is sufficient to induce the right operational behavior,
provided the compiler isn't bone headed (and further, is lenient enough to
allow sufficiently smart compilers to disregard our naive 'evaluate x before
y' reading of seq if it's more efficient to do so).
> Not so for
> serialize: I would like a serialize function, but I don't want the
> semantic burden it brings. If only there were a way to...
> oh yeah.
> serialize :: (a -> b) -> IO String
> I still don't really get what we're arguing about.
I don't know.
More information about the Haskell-Cafe