From 6d430f795dcc2b1059365cecd93b6649ca79b53b Mon Sep 17 00:00:00 2001 From: Daniel Slapman Date: Tue, 30 Aug 2022 00:47:30 +0300 Subject: [PATCH] Optics for TupleN Closes #5 --- build.sbt | 2 ++ .../main/boilerplate/glass/tuples/package.template | 11 +++++++++++ project/plugins.sbt | 2 ++ 3 files changed, 15 insertions(+) create mode 100644 modules/core/src/main/boilerplate/glass/tuples/package.template diff --git a/build.sbt b/build.sbt index 36f6677..49a91ed 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,7 @@ import Publish._, Dependencies._ import com.typesafe.sbt.SbtGit.git import sbt.ModuleID +import spray.boilerplate.BoilerplatePlugin lazy val setMinorVersion = minorVersion := { CrossVersion.partialVersion(scalaVersion.value) match { @@ -42,6 +43,7 @@ lazy val defaultSettings = Seq( lazy val opticsCore = project .in(file("modules/core")) + .enablePlugins(BoilerplatePlugin) .settings( defaultSettings, libraryDependencies ++= Seq(catsCore, alleycats), diff --git a/modules/core/src/main/boilerplate/glass/tuples/package.template b/modules/core/src/main/boilerplate/glass/tuples/package.template new file mode 100644 index 0000000..34005ea --- /dev/null +++ b/modules/core/src/main/boilerplate/glass/tuples/package.template @@ -0,0 +1,11 @@ +package glass + +package object tuples { + [#implicit class Tuple1Exts(val tpl: Tuple1.type) extends AnyVal { + [#def _1[[#T1#]]: Contains[Tuple1[[#T1#]], T1] = + Contains((tpl: Tuple1[[#T1#]]) => tpl._1)((tpl: Tuple1[[#T1#]], v1: T1) => tpl.copy(_1 = v1))# + ] + }# + + ] +} \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 28addc7..90a7e8c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -25,3 +25,5 @@ addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.2") + +addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.6.1")