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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Justus Adam
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.

My question is this: Is this intentional? Is there now a consensus that there should not be user constructed types? Or is there some subtile issue that I’m missing wich prevents user constructed types for now or always?

Thanks in advance guys.

Best regards.

Justus
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Edward Kmett-2
Did you mean Type.Reflection

(reflection's Data.Reflection offers a completely unrelated notion of Typeable reflection, hence my confusion.)

-Edward

On Sat, Feb 10, 2018 at 5:16 AM, Development <[hidden email]> wrote:
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.

My question is this: Is this intentional? Is there now a consensus that there should not be user constructed types? Or is there some subtile issue that I’m missing wich prevents user constructed types for now or always?

Thanks in advance guys.

Best regards.

Justus
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Ben Gamari-2
In reply to this post by Justus Adam
Development <[hidden email]> 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

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Justus Adam
Ah thanks. I had no idea the `App` pattern actually was bidirectional. I had tried the `Con’` pattern but that is only valid for deconstruction.
Is there any way to tell in the docs whether a pattern is bidirectional?

> On 12 Feb 2018, at 18:30, Ben Gamari <[hidden email]> wrote:
>
> Development <[hidden email]> 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

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

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

Ben Gamari-2
Development <[hidden email]> writes:

> Ah thanks. I had no idea the `App` pattern actually was bidirectional. I had tried the `Con’` pattern but that is only valid for deconstruction.
> Is there any way to tell in the docs whether a pattern is bidirectional?
>
Hmmm, that is a good question. Indeed this appears to be quite unclear.

Alex, is this a known issue?

Cheers,

- Ben


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (497 bytes) Download Attachment