Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clarifi branch with master branch changes and other fixes. #2

Merged
merged 15 commits into from
Oct 19, 2017
Merged
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ jdk:
- openjdk6
- openjdk7
- oraclejdk7
- oraclejdk8
scala:
- 2.9.2
- 2.10.1
- 2.10.6
- 2.11.8
- 2.12.3
matrix:
exclude:
- jdk: openjdk7
scala: 2.12.3
18 changes: 7 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,31 @@ import CrossVersion.partialVersion

name := "machines"

version := "1.0"
version := "1.2"

description := "Streaming I/O for Scala"

libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.0.6"
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.2.16"

libraryDependencies += "org.scalaz" %% "scalaz-effect" % "7.0.6"
libraryDependencies += "org.scalaz" %% "scalaz-effect" % "7.2.16"

libraryDependencies += {
val scalacheck = if (scalaVersion.value == "2.9.2") "1.10.0" else "1.11.3"
"org.scalacheck" %% "scalacheck" % scalacheck % "test"
}
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"

scalaVersion := "2.11.0"
scalaVersion := "2.12.3"

crossScalaVersions := Seq("2.9.2", "2.9.3", "2.10.3", "2.11.0")
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.3")

scalacOptions ++= Seq("-deprecation", "-unchecked")

scalacOptions ++= {
val non29 = Seq("-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-language:postfixOps")
partialVersion(scalaVersion.value) match {
case Some((2, 9)) => Seq("-Ydependent-method-types")
case Some((2, 10)) => non29
case sv => non29 ++ Seq("-Ywarn-unused-import")
}
}

seq(bintraySettings:_*)
Seq(bintraySettings:_*)

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

Expand Down
4 changes: 0 additions & 4 deletions clarifi.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
organization := "clarifi"

publishArtifact in (Compile, packageDoc) := false

publishArtifact in (Compile, packageSrc) := false

version := { ("git rev-parse HEAD" !!).trim }

publishMavenStyle := false


2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.1
sbt.version=0.13.16
2 changes: 1 addition & 1 deletion src/main/scala/com/clarifi/machines/Driver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scalaz.Id._
* A `Driver[K]` can step through a machine that requests inputs described by `K`
* and have effects described by `M` at each step.
*/
trait Driver[M[+_], K] { self =>
trait Driver[M[_], K] { self =>

implicit def M: Monad[M]

Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/com/clarifi/machines/Procedure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scalaz._
* that machine through the use of effects. A `Procedure[M, T]`
* is conceptually a stream of elements of type `T` produced with effects described by `M`.
*/
trait Procedure[M[+_], +A] { self =>
trait Procedure[M[_], A] { self =>
type K

def map[B](f: A => B): Procedure[M, B] =
Expand All @@ -29,11 +29,11 @@ trait Procedure[M[+_], +A] { self =>

def foreach(f: A => M[Unit]): M[Unit] = foldMapM(f)(Monoid instance ((_, b) => b, ()))

def execute[B >: A](implicit B: Monoid[B]): M[B] =
withDriver(d => d.drive(machine)(d.M.pure(_:B)))
def execute(implicit A: Monoid[A]): M[A] =
withDriver(d => d.drive(machine)(d.M.pure(_:A)))

def foldLeftM[B >: A, C](initial: C)(f: (C, B) => C): M[C] =
withDriver(d => d.driveLeft(machine)(d.M.pure(_:B))(initial)(f))
def foldLeftM[C](initial: C)(f: (C, A) => C): M[C] =
withDriver(d => d.driveLeft(machine)(d.M.pure(_:A))(initial)(f))

def andThen[B](p: Process[A, B]): Procedure[M, B] =
new Procedure[M, B] {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/clarifi/machines/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ package object machines {
*/
type Source[+O] = Machine[Nothing, O]

sealed class SourceW[+O](s: Source[O]) {
sealed class SourceW[O](s: Source[O]) {
def idProcedure: Procedure[Id, O] = new Procedure[Id, O] {
type K = Nothing
def machine = s
def withDriver[R](f: Driver[Id, Nothing] => R): R =
f(Driver.Id[Nothing](identity))
}

def procedure[M[+_]: Monad]: Procedure[M, O] =
def procedure[M[_]: Monad]: Procedure[M, O] =
new Procedure[M, O] {
type K = Nothing
def machine = s
Expand Down
1 change: 1 addition & 0 deletions src/test/scala/com/clarifi/machines/TestTee.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.scalacheck.{Gen, Properties, Prop}
import Prop._
import com.clarifi.machines.Tee._
import com.clarifi.machines.Source._
import scalaz.std.anyVal._

object TestTee extends Properties("Tee") {
val q1 = Source(List(("3", 1), ("5", 2), ("7", 2))).idProcedure
Expand Down