[jhc] explanation of FrontEnd.KindInfer.constrain
Samuel Bronson
naesten at gmail.com
Wed Mar 19 19:16:16 EDT 2008
On 3/19/08, John Meacham <john at repetae.net> wrote:
> On Wed, Mar 19, 2008 at 06:55:29PM -0400, Samuel Bronson wrote:
> > > 2. an actual '?' or '??' is sneaking in as a kind when it should have
> > > been turned into a freshly instantiated kind variable with a ? or ??
> > > constraint as appropriate.
> >
> > Where is this process supposed to happen? I didn't see anything that
> > looked like that in KindInfer, and I don't think it could be anywhere
> > else, since the monad it would need to work in is only available in
> > that module...
>
> Well, that's the thing, I never implemented users being able to use '?'
> and '??' directly, so I never needed to implement it for user defined
> kinds.
Well, what are the KBase constructors for, then? "Future proofing" is
clearly not a very good answer...
> where it currently happens is in KindInfer in all the calls to
> 'newKindVar' in kiType. notice that when you have an unboxed tuple for
> instance, its subkinds are declared with ?? constraints. likewise for a
> function call and so forth.
>
> so what needs to happen for user defined ones to work is for
> 'lookupKind' to create a freshly instantiated version of the constructor
> with no literal ? or ??'s in it, just constrained kindvars.
>
> note that this brings up intruging possibilities. like
>
> data Complex (a :: ??) = a :+: a
>
> notice you can now have data structures with polymorphic unboxed values
> in them! so your complex Float can actually have two unboxed floats next
> to each other. but this raises several other issues when it comes to
> actaully generating code for that.
>
> note also that the primitive pre-defined tArrow in DataConstructors has
> the wrong type. this is a known bug but the current workarounds are okay
> for now and it will be a fairly complicated one to fix.
>
> John
>
> --
> John Meacham - ⑆repetae.net⑆john⑈
> _______________________________________________
> jhc mailing list
> jhc at haskell.org
> http://www.haskell.org/mailman/listinfo/jhc
>
More information about the jhc
mailing list