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.sm...@gmail.com> wrote:

> On Fri, May 10, 2013 at 9:04 AM, MigMit <miguelim...@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@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to