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

Alexander Solla alex.solla at gmail.com
Sat May 11 00:52:22 CEST 2013


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

> On Fri, May 10, 2013 at 5:49 PM, Alexander Solla <alex.solla at gmail.com>wrote:
>
>> 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
>>
>
> I do like DataKinds a lot,  and I did think about them a little bit with
> respect to this problem,  but a solution isn't obvious to me,  and perhaps
> more importantly I'd like to be able to support older versions of GHC,
>  probably back to 7.0 at least.
>
> The issue is that every call to init needs to return a slightly different
> type,  and whether this is achieved via phantom types or datakinds,  it
> seems to me some form of existential typing is required.  As both Andres
> and MigMit pointed out,  you can sort of achieve this by using a
> continuation-like construction and higher-ranked types (is there a name for
> this transform?  I've seen it a number of times and it is pretty well
> known...),  but this enforces a dynamic extent on the descriptor whereas
> the original interface I proposed allows an indefinite extent.
>

I know what extensions (of predicates and the like) are, but what exactly
does "dynamic" and "indefinite" mean in this context?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130510/23da0a1a/attachment.htm>


More information about the Haskell-Cafe mailing list