<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I am going to strengthen my statement and keep restating it — PolyKinds is for sure our destination, the path to it is the question.<div class=""><br class=""></div><div class="">I am just as perplexed as Simon on why it is breaking like this and it would be great to understand it better.</div><div class=""><br class=""></div><div class="">Chris</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 6 Jul 2022, at 09:35, Simon Peyton Jones <<a href="mailto:simon.peytonjones@gmail.com" class="">simon.peytonjones@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:tahoma,sans-serif">Like Richard, I'd be sad to think that PolyKinds is causing problems, and would like to understand better.  For example, at the term level we wioudl not dream of making monomorphism the default!  So why would we do that at the type level?  Maybe it is a shortcoming of inference or error messages.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">However the error is a bit perplexing. <br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif;margin-left:40px">class (Typeable a) => S a <br class=""><br class="">newtype D a = D { getD :: Int }<br class=""><br class="">instance (Typeable a) => S (D a) <br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">We get the error Chris shows.  But it looks as if we have done all that is needful.  We need (Typeable (D a)) and we have provided (Typeable a).  What gives?   Well, what we really need is (Typeable (D @k a)), and for that we need (Typeable k) too.  But that's very far from clear.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I sort of wonder: if we have (Typeable t) should that not give us (Typeable k) where (t :: k)?  That would require us to have a function typeRepKind :: TypeRep (a::k) -> TypeRep k, and I don't know how hard that is to get.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br class=""></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Simon<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 5 Jul 2022 at 16:03, Richard Eisenberg <<a href="mailto:lists@richarde.dev" target="_blank" class="">lists@richarde.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">I find that surprising, and disappointing. I think of PolyKinds as largely innocuous, except in strange scenarios, which is why PolyKinds is included in GHC2021. If that is wrong, perhaps we should consider not including PolyKinds in GHC2023...<div class=""><br class=""></div><div class="">It would be interesting to learn more about what's going wrong.</div><div class=""><br class=""></div><div class="">Richard<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jul 5, 2022, at 10:26 AM, Chris Dornan <<a href="mailto:chris@chrisdornan.com" target="_blank" class="">chris@chrisdornan.com</a>> wrote:</div><br class=""><div class=""><div dir="auto" class="">yup, i should have started there—all my recent troubles have come from PolyKinds!</div><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 5 Jul 2022 at 15:00, Richard Eisenberg <<a href="mailto:lists@richarde.dev" target="_blank" class="">lists@richarde.dev</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is PolyKinds, which generalizes the kind of D, meaning that satisfying the Typeable a superclass constraint of C also requires a Typeable k constraint, where (a :: k).<br class="">
<br class="">
Richard<br class="">
<br class="">
> On Jul 2, 2022, at 12:49 AM, Chris Dornan <<a href="mailto:chris@chrisdornan.com" target="_blank" class="">chris@chrisdornan.com</a>> wrote:<br class="">
> <br class="">
> Quick quiz: the below Haskell2010 ‘Phantoms' module (also in this Gist: <a href="https://gist.github.com/cdornan/f75cd8024434d998c87610cbb7fb6ab3" rel="noreferrer" target="_blank" class="">https://gist.github.com/cdornan/f75cd8024434d998c87610cbb7fb6ab3</a>) appears (for me on GHC 9.2.2 and 9.2.3) to not be a GHC2021 module, reporting this error under the latter configuration:<br class="">
> <br class="">
> Phantoms.hs:22:10: error:<br class="">
>    • Could not deduce (Typeable k)<br class="">
>        arising from the superclasses of an instance declaration<br class="">
>      from the context: (C a, Typeable a)<br class="">
>        bound by the instance declaration<br class="">
>        at Phantoms.hs:22:10-36<br class="">
>    • In the instance declaration for ‘S (D a)’<br class="">
>   |<br class="">
> 22 | instance (C a,Typeable a) => S (D a) where smethod = undefined<br class="">
>   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^<br class="">
> <br class="">
> Phantoms.hs:22:10: error:<br class="">
>    • Could not deduce (Typeable k)<br class="">
>        arising from the superclasses of an instance declaration<br class="">
>      from the context: (C a, Typeable a)<br class="">
>        bound by the instance declaration<br class="">
>        at Phantoms.hs:22:10-36<br class="">
>    • In the instance declaration for ‘S (D a)’<br class="">
>   |<br class="">
> 22 | instance (C a,Typeable a) => S (D a) where smethod = undefined<br class="">
> <br class="">
> The question is which language extension(s) are giving rise to these errors?<br class="">
> <br class="">
> The ‘Phantoms' module is this:<br class="">
> <br class="">
> {-# LANGUAGE DerivingVia #-}<br class="">
> <br class="">
> module Phantoms where<br class="">
> <br class="">
> import Data.Typeable<br class="">
> <br class="">
> <br class="">
> class C a where<br class="">
>  cmethod :: Proxy a -> ()<br class="">
> <br class="">
> class (Show a, Typeable a) => S a where<br class="">
>  smethod :: a -> Int<br class="">
> <br class="">
> <br class="">
> newtype UsingD a = UsingD { getUsingD :: a }<br class="">
> <br class="">
> <br class="">
> newtype D a = D { getD :: Int }<br class="">
>    deriving (Show) via UsingD (D a)<br class="">
> <br class="">
> <br class="">
> instance (C a,Typeable a) => S (D a) where smethod = undefined<br class="">
> <br class="">
> instance (C a,Typeable a) => Show (UsingD a) where showsPrec = undefined<br class="">
> <br class="">
> <br class="">
> instance (C a) => C (D a) where cmethod _ = undefined<br class="">
> <br class="">
> _______________________________________________<br class="">
> ghc-steering-committee mailing list<br class="">
> <a href="mailto:ghc-steering-committee@haskell.org" target="_blank" class="">ghc-steering-committee@haskell.org</a><br class="">
> <a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank" class="">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br class="">
<br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">
ghc-steering-committee mailing list<br class="">
<a href="mailto:ghc-steering-committee@haskell.org" target="_blank" class="">ghc-steering-committee@haskell.org</a><br class="">
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank" class="">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>