-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add scalafix for contramap * Remove redundancies * Try to build scalafix with travis * Working travis tests * Publish snapshot before running scalafix * Simplify denotation lookup
- Loading branch information
LukaJCB
authored
Oct 10, 2017
1 parent
b84015a
commit b3244a8
Showing
6 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ sudo: required | |
|
||
dist: trusty | ||
|
||
group: edge | ||
group: edge | ||
|
||
git: | ||
depth: 9999 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
scalafix/input/src/main/scala/fix/v1_0_0/ContraMapToLMap.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
rule = "scala:fix.v1_0_0.ContraMapToLMap" | ||
*/ | ||
package fix | ||
package to1_0_0 | ||
|
||
|
||
|
||
object ContraMapToLMapTests { | ||
import cats.Show | ||
import cats.syntax.all._ | ||
import cats.instances.all._ | ||
|
||
val f: Int => String = _.toString | ||
|
||
val g: Int => String = f.contramap(_ + 1) | ||
|
||
object Foo | ||
object Bar | ||
object Baz | ||
|
||
implicit val showFoo: Show[Foo.type] = Show.fromToString | ||
|
||
val showBar: Show[Bar.type] = showFoo.contramap(_ => Foo) | ||
|
||
val showBaz: Show[Baz.type] = Show[Foo.type].contramap(_ => Foo) | ||
|
||
def getShowBar(): Show[Bar.type] = showBar | ||
|
||
getShowBar().contramap((_: Int) => Bar) | ||
} |
28 changes: 28 additions & 0 deletions
28
scalafix/output/src/main/scala/fix/v1_0_0/ContraMapToLMap.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package fix | ||
package to1_0_0 | ||
|
||
|
||
|
||
object ContraMapToLMapTests { | ||
import cats.Show | ||
import cats.syntax.all._ | ||
import cats.instances.all._ | ||
|
||
val f: Int => String = _.toString | ||
|
||
val g: Int => String = f.lmap(_ + 1) | ||
|
||
object Foo | ||
object Bar | ||
object Baz | ||
|
||
implicit val showFoo: Show[Foo.type] = Show.fromToString | ||
|
||
val showBar: Show[Bar.type] = showFoo.contramap(_ => Foo) | ||
|
||
val showBaz: Show[Baz.type] = Show[Foo.type].contramap(_ => Foo) | ||
|
||
def getShowBar(): Show[Bar.type] = showBar | ||
|
||
getShowBar().contramap((_: Int) => Bar) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters