[Haskell-cafe] A use case for *real* existential types

Leon Smith leon.p.smith at gmail.com
Fri May 10 21:52:56 CEST 2013


On Fri, May 10, 2013 at 9:04 AM, MigMit <miguelimo38 at yandex.ru> wrote:

> With that kind of interface you don't actually need existential types. Or
> phantom types. You can just keep Inotify inside the Watch, like this:
>

Right, that is an alternative solution,  but phantom types are a relatively
simple and well understood way of enforcing this kind of property in the
type system without incurring run-time costs.   My inotify binding is
intended to be as thin as possible,  and given my proposed interface,   you
could implement your interface in terms of mine,  making the phantom types
disappear using the restricted existentials already available in GHC,   and
such a wrapper should be just as efficient as if you had implemented your
interface directly.

Best,
Leon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130510/1bb0d5c6/attachment.htm>


More information about the Haskell-Cafe mailing list