User constructed types with new Data.Typeable and Data.Reflection

Ben Gamari ben at smart-cactus.org
Mon Feb 12 17:30:55 UTC 2018


Development <dev at justus.science> writes:

> Hey guys I have a (hopefully quick) question.
>
> With the new `Data.Typeable` and `Data.Reflection` in base 4.10 have we really lost the ability for users to compose `TypeRep`’s?
>
> I was using `Data.Typeable` before (mainly `mkTyConApp`). But in the
> new base 4.10 I cannot find any way to achieve the same goal.
>
> I have read the wiki page Typeable and Typeable/BenGamari and neither
> explicitly mentions the removal of `mkTyConApp` and similar
> facilities. In fact the latter mentions potential implementations for
> user constructed type applications twice with `mkTrApp` at the
> beginning of the page and `mkApp` at the end.
> Furthermore the documentation for `Typeable` (and `Reflection`) also
> never mentions the fact that this functionality was removed.
>

Indeed, as is noted in the changelog for base [1], mkTyConApp and
friends were removed. mkTyConApp in particular allowed the construction
of ill-kinded type representations so instead of emulating the previous
behavior we rather opted to remove it.

If you were previously using these interfaces you almost certainly want
to instead use the new type-indexed interface provided by
Type.Reflection. In particular, you can use the App constructor in
place of mkTyConApp.

Cheers,

- Ben


[1] https://hackage.haskell.org/package/base-4.10.1.0/changelog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180212/c376cf3e/attachment.sig>


More information about the ghc-devs mailing list