Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

7mind/no-more-orphans

Companion repository for 'No More Orphans'

7mind/no-more-orphans.json
{
"createdAt": "2019-04-25T12:46:44Z",
"defaultBranch": "develop",
"description": "Companion repository for 'No More Orphans'",
"fullName": "7mind/no-more-orphans",
"homepage": "https://blog.7mind.io/no-more-orphans.html",
"language": "Scala",
"name": "no-more-orphans",
"pushedAt": "2022-10-13T19:40:44Z",
"stargazersCount": 14,
"topics": [
"blog",
"implicits",
"orphans",
"scala",
"typeclasses"
],
"updatedAt": "2023-04-28T13:40:53Z",
"url": "https://github.com/7mind/no-more-orphans"
}

This is a sample project that defines a couple optional typeclass instances using No More Orphans trick. More details are in the accompanying blog post.

Use SBT to run the test suite:

git clone https://github.com/7mind/no-more-orphans.git
cd no-more-orphans
sbt test

Tested on Scala 2.12.12, 2.13.3, 2.11.12 (2.11 only works partially) and dotty

Addendum: the pattern may not work for non-higher-kinded types on Scala 2 (i.e. plain types like Int, not type constructors like List[_] or typeclasses like Monad[_[_]]).