diff options
author | Georgi Krastev <joro.kr.21@gmail.com> | 2017-11-29 19:53:01 +0100 |
---|---|---|
committer | Georgi Krastev <joro.kr.21@gmail.com> | 2017-11-29 20:05:50 +0100 |
commit | d8fb2f5ca2edc1a34ed7831f06d5eca08ba4989c (patch) | |
tree | 879238ab17d24e05457d158e6af76879a53aea5a /examples/shared/src/main/scala | |
parent | 93ff9742cf8cd9f2c60986ff4f7af8d24e268b1f (diff) | |
download | magnolia-d8fb2f5ca2edc1a34ed7831f06d5eca08ba4989c.tar.gz magnolia-d8fb2f5ca2edc1a34ed7831f06d5eca08ba4989c.tar.bz2 magnolia-d8fb2f5ca2edc1a34ed7831f06d5eca08ba4989c.zip |
Existentially abstract unbound subtype parameters
That happens when the subtype of a sealed trait has more type
parameters than its parent. When those extra type parameters are
covariant they are replaced by their upper bounds, otherwise they
are existentially quantified.
Diffstat (limited to 'examples/shared/src/main/scala')
-rw-r--r-- | examples/shared/src/main/scala/show.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/shared/src/main/scala/show.scala b/examples/shared/src/main/scala/show.scala index 50b34ee..9f634ba 100644 --- a/examples/shared/src/main/scala/show.scala +++ b/examples/shared/src/main/scala/show.scala @@ -60,4 +60,10 @@ object Show extends GenericShow[String] { implicit val int: Show[String, Int] = new Show[String, Int] { def show(s: Int): String = s.toString } + + /** show typeclass for sequences */ + implicit def seq[A](implicit A: Show[String, A]): Show[String, Seq[A]] = + new Show[String, Seq[A]] { + def show(as: Seq[A]): String = as.iterator.map(A.show).mkString("[", ",", "]") + } } |