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

Add scalaz.{Equal, Show} instances #179

Merged
merged 1 commit into from Jun 16, 2016
Merged

Add scalaz.{Equal, Show} instances #179

merged 1 commit into from Jun 16, 2016

Conversation

fthomas
Copy link
Owner

@fthomas fthomas commented Jun 15, 2016

No description provided.

@codecov-io
Copy link

Current coverage is 98.47%

Merging #179 into master will increase coverage by <.01%

Powered by Codecov. Last updated by 05dc4e8...276c2f9

@fthomas fthomas merged commit 77ac14b into master Jun 16, 2016
@fthomas
Copy link
Owner Author

fthomas commented Jul 5, 2016

BTW, since Equal and Show are both contravariant functors, the two instances could be implemented in terms of a general function that abstracts over type classes that are contravariant functors:

  implicit def refTypeEqual[F[_, _]: RefType, T: Equal, P]: Equal[F[T, P]] =
    xxx[F, T, P, Equal]

  implicit def refTypeShow[F[_, _]: RefType, T: Show, P]: Show[F[T, P]] =
    xxx[F, T, P, Show]

  def xxx[F[_, _], T, P, TC[_]: Contravariant](implicit rt: RefType[F], tc: TC[T]): TC[F[T, P]] =
    tc.contramap(rt.unwrap)

@fthomas fthomas deleted the topic/equal-show branch July 26, 2016 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants