[Haskell-cafe] Playing with ATs again

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Aug 5 01:28:52 EDT 2010


On 4 August 2010 03:45, Ryan Ingram <ryani.spam at gmail.com> wrote:
> So I believe the "final" way to do this, which is not yet implemented,
> works something like this:
>
> type family LeftToRight a
> type family RightToLeft b
>
> class (LeftToRight a ~ b, RightToLeft b ~ a) => Bijection a b where
>   ...
>
> I agree, the fact that this doesn't work is really dumb.

The reason Manuel Chakravarty gave me (if I recall correctly) that
this doesn't work is as follows:

Type classes are stored in dictionaries.  To be able to have
superclass constraints like this requires that type information also
be stored in those dictionaries, which currently isn't done.  They
could have added this functionality in, but SPJ was going to be
working on a new type-checker anyway (which I believe is now done) so
this was postponed until after the new type-checker was finished.  As
we should hopefully be seeing 6.14 out in a few months time, there
isn't time to be able to get superclass constraints in for it, so we
probably won't have them until 6.16 next year.

So, I wouldn't say that it's "dumb".  Unfortunate, a pity, etc., but not "dumb".

Don't forget, GHC is open source: if this lack really was "dumb" and
annoying you, there was nothing stopping you from rectifying this
situation up until now.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list