Skip to content

Add toRep #238

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Dec 26, 2020
Merged

Add toRep #238

merged 3 commits into from
Dec 26, 2020

Conversation

JordanMartinez
Copy link
Contributor

@JordanMartinez JordanMartinez commented Dec 25, 2020

Fixes #246

@@ -34,3 +37,6 @@ newtype Argument a = Argument a
class Generic a rep | a -> rep where
to :: rep -> a
from :: a -> rep

toRep :: forall from to. Generic from to => Proxy from -> Proxy to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reuse a and rep variables, like in the class declaration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -34,3 +37,6 @@ newtype Argument a = Argument a
class Generic a rep | a -> rep where
to :: rep -> a
from :: a -> rep

toRep :: forall from to. Generic from to => Proxy from -> Proxy to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I don’t know about you but I frequently confuse to and from, and I’m sure having to :: rep -> a but toRep :: Proxy a -> Proxy rep is going to be even more confusing to me 😬 May I suggest repOf instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

Copy link
Member

@kl0tl kl0tl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@JordanMartinez JordanMartinez merged commit 894e8f9 into purescript:master Dec 26, 2020
turlando pushed a commit to purescm/purescript-prelude that referenced this pull request Sep 3, 2021
* Add toRep

* Update type variable names to match class names

* Rename toRep to repOf
@JordanMartinez JordanMartinez deleted the addToRep branch September 24, 2021 14:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[generics-rep] Add a toRep function
3 participants