-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add toRep #238
Conversation
src/Data/Generic/Rep.purs
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/Data/Generic/Rep.purs
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* Add toRep * Update type variable names to match class names * Rename toRep to repOf
Fixes #246