Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Type classes: use standard inheritance but hide it #1647

Merged
merged 1 commit into from
Feb 10, 2018

Conversation

jbgi
Copy link
Member

@jbgi jbgi commented Feb 8, 2018

Subtyping is hiden from type system (and implicit resolution) through invariant abstract type (zero-cost wrapper) in InstanceOfModule.

See Original idea by @TomasMikula.

Ease of use of traditional encoding is thus preserved at the minor cost of wrapping instances construction in an instanceOf method call.

Remove all Template classes. This also force type class instance to use inheritance (to preserve performance).

@NeQuissimus
Copy link
Member

This is certainly interesting :)

@TomasMikula
Copy link
Member

Looking good!

 through abstract type of InstanceOfModule
Copy link
Contributor

@edmundnoble edmundnoble left a comment

Choose a reason for hiding this comment

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

Beautiful. And we lost code, too.

@TomasMikula TomasMikula merged commit 3aa3166 into scalaz:series/8.0.x Feb 10, 2018
@SystemFw
Copy link

Really nice

@andyscott
Copy link

I also really like this. Nice work!

@fosskers
Copy link
Contributor

Benchmarks?

@jdegoes
Copy link
Member

jdegoes commented Feb 12, 2018

@jbgi Nice work! Worth documenting in the Scalaz 8 design guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants