Skip to content

Commit a179bae

Browse files
committed
scaladoc added
1 parent 3fba32a commit a179bae

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

build.sbt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,20 @@ lazy val root = project
1919
.in(file("."))
2020
.aggregate(gopher.js, gopher.jvm)
2121
.settings(
22-
Sphinx / sourceDirectory := baseDirectory.value / "docs",
2322
git.remoteRepo := "[email protected]:rssh/scala-gopher.git",
23+
SiteScaladocPlugin.scaladocSettings(GopherJVM, gopher.jvm / Compile / packageDoc / mappings, "api/jvm"),
24+
SiteScaladocPlugin.scaladocSettings(GopherJS, gopher.js / Compile / packageDoc / mappings, "api/js"),
25+
siteDirectory := baseDirectory.value / "target" / "site",
2426
publishArtifact := false,
25-
).enablePlugins(GhpagesPlugin)
27+
).enablePlugins(GhpagesPlugin, SiteScaladocPlugin)
2628

2729

2830

2931
lazy val gopher = crossProject(JSPlatform, JVMPlatform)
3032
.in(file("."))
3133
.settings(sharedSettings)
3234
.disablePlugins(SitePlugin)
35+
.disablePlugins(SitePreviewPlugin)
3336
.jvmSettings(
3437
scalacOptions ++= Seq( "-unchecked", "-Ycheck:macros", "-uniqid", "-Xprint:types" ),
3538
).jsSettings(
@@ -39,3 +42,5 @@ lazy val gopher = crossProject(JSPlatform, JVMPlatform)
3942
scalaJSUseMainModuleInitializer := true,
4043
)
4144

45+
lazy val GopherJVM = config("gopher.jvm")
46+
lazy val GopherJS = config("gopher.js")

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
2-
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
2+
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
33
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
44
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
55
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")

shared/src/main/scala/gopher/ReadChannel.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import scala.concurrent.duration.Duration
1010

1111
import java.util.logging.{Level => LogLevel}
1212

13-
13+
/**
14+
* ReadChannel: Interface providing reading API.
15+
*
16+
**/
1417
trait ReadChannel[F[_], A]:
1518

1619
thisReadChannel =>

shared/src/main/scala/gopher/Select.scala

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,26 @@ import scala.quoted._
66
import scala.compiletime._
77
import scala.concurrent.duration._
88

9-
9+
/** Organize waiting for read/write from multiple async channels
10+
*
11+
* Gopher[F] provide a function `select` of this type.
12+
*/
1013
class Select[F[_]](api: Gopher[F]):
1114

15+
/** wait until some channels from the list in <code> pf </code>.
16+
*
17+
*```Scala
18+
*async{
19+
* ....
20+
* select {
21+
* case vx:xChannel.read => doSomethingWithX
22+
* case vy:yChannel.write if (vy == valueToWrite) => doSomethingAfterWrite(vy)
23+
* case t: Time.after if (t == 1.minute) => processTimeout
24+
* }
25+
* ...
26+
*}
27+
*```
28+
*/
1229
transparent inline def apply[A](inline pf: PartialFunction[Any,A]): A =
1330
${
1431
Select.onceImpl[F,A]('pf, 'api )
@@ -51,9 +68,7 @@ class Select[F[_]](api: Gopher[F]):
5168
def afold_async[S](s0:S)(step: S => F[S | SelectFold.Done[S]]) : F[S] =
5269
fold_async(s0)(step)
5370

54-
55-
//def map[A](step: PartialFunction[SelectGroup[F,A],A|SelectFold.Done[Unit]]): ReadChannel[F,A] =
56-
71+
5772
def map[A](step: SelectGroup[F,A] => A): ReadChannel[F,A] =
5873
mapAsync[A](x => api.asyncMonad.pure(step(x)))
5974

0 commit comments

Comments
 (0)