[Haskell-cafe] Can I get 'forall (a :: k). Typeable a => Dict (Typeable k)'?
Adam Gundry
adam at well-typed.com
Wed Aug 23 11:10:24 UTC 2023
Hi Tom,
I think you are looking for Type.Reflection.typeRepKind
typeRepKind :: TypeRep (a :: k) -> TypeRep k
which combined with
typeRep :: Typeable a => TypeRep a
withTypeable :: forall k (a :: k) rep (r :: TYPE rep). TypeRep a ->
(Typeable a => r) -> r
should allow you to define
kindable :: forall (a :: k). Typeable a => Dict (Typeable k)
as your subject line asked for, albeit not the message body. :-)
Cheers,
Adam
On 23/08/2023 11:50, Tom Ellis wrote:
> Morally I think that
>
> class Typeable (a :: k)
>
> should have been
>
> class Typeable k => Typeable (a :: k)
>
> If I'm wrong, could someone please elaborate why? If I'm right,
> please read on ...
>
> That would be a breaking change, but could we at least get
>
> kindable :: forall (a :: k). Typeable a => Dict (Typable (a :: k))
>
> in the meantime?
>
> Tom
--
Adam Gundry, Haskell Consultant
Well-Typed LLP, https://www.well-typed.com/
Registered in England & Wales, OC335890
27 Old Gloucester Street, London WC1N 3AX, England
More information about the Haskell-Cafe
mailing list