Skip to content

Commit

Permalink
map band instance (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarquez authored and xuwei-k committed May 22, 2017
1 parent 74757ff commit be8a62f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/scalaz/Map.scala
Expand Up @@ -1007,6 +1007,10 @@ sealed abstract class ==>>[A, B] {
}

sealed abstract class MapInstances0 {
implicit def mapBand[A, B](implicit A: Order[A], B: Band[B]): Band[A ==>> B] = new Band[A ==>> B] {
def append(a: A ==>> B, b: => A ==>> B): A ==>> B =
(a unionWith b)(B.append(_, _))
}

implicit def scalazMapInstance[S: Order]: Bind[S ==>> ?] with Align[S ==>> ?] with Zip[S ==>> ?] =
new Bind[S ==>> ?] with Align[S ==>> ?] with Zip[S ==>> ?] {
Expand Down
1 change: 1 addition & 0 deletions tests/src/test/scala/scalaz/MapTest.scala
Expand Up @@ -971,6 +971,7 @@ object MapTest extends SpecLite {

checkAll(order.laws[Int ==>> Int])
checkAll(monoid.laws[Int ==>> Int])
checkAll(band.laws[Int ==>> ISet[Int]])

{
implicit def equMapConj[A: Equal, B: Equal]: Equal[(A ==>> B) @@ Tags.Conjunction] =
Expand Down

0 comments on commit be8a62f

Please sign in to comment.