Exceptions
Ashley Yakeley
ashley at semantic.org
Thu Aug 31 06:03:36 EDT 2006
In article
<2E9B33CE230409489A7ED37E5E34090F0541A61D at EUR-MSG-20.europe.corp.microso
ft.com>,
"Simon Marlow" <simonmar at microsoft.com>
wrote:
> I don't think we need more extensions to do a reasonable job of
> extensible exceptions:
>
> http://www.haskell.org/~simonmar/papers/ext-exceptions.pdf
You write:
> Compared to our approach, theirs requires new extensions to the language
> (although not deep),
"Typeable" is an extension to Haskell, and a rather ugly one at that.
The open datatypes extension is both cleaner and more general.
> and has difficulties with separate compilation.
They claim to solve this I think, though I haven't examined it really
carefully. You may know better, of course.
> Arguably the open data types approach is more direct and more accessible,
Yes,
> as is often the case with extensions designed to solve a particular problem.
That's not fair. Open datatypes have other applications. A general "file
interpreter" for instance, that given a MIME type string and a list of
bytes yields an object. Or a collection of variable "resources" of
various types that could be passed to a program. Or a hierarchy of UI
widgets. Or anything that Typeable and Dynamic are currently used for,
but more cleanly. Hs-plugins, for instance.
It's the missing piece.
> Still, the argument for adding open data types to the language is weakened by
> the fact that they are subsumed by type classes: in fact the authors give an
> encoding of open data types into type classes,
Well not really. The "encoding" involves lifting everything from values
to types, which means a function still can't return a value of an open
type determined at run-time.
--
Ashley Yakeley
Seattle WA
More information about the Haskell-prime
mailing list