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

Alexander Solla alex.solla at gmail.com
Fri May 10 23:49:35 CEST 2013


I'm not sure if it would work for your case, but have you considered using
DataKinds instead of phantom types?  At least, it seems like it would be
cheap to try out.

http://www.haskell.org/ghc/docs/7.4.2/html/users_guide/kind-polymorphism-and-promotion.html


On Fri, May 10, 2013 at 12:52 PM, Leon Smith <leon.p.smith at gmail.com> wrote:

> 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
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130510/0542bf0f/attachment.htm>


More information about the Haskell-Cafe mailing list