diff --git a/answers/src/main/scala/fpinscala/applicative/Applicative.scala b/answers/src/main/scala/fpinscala/applicative/Applicative.scala index b88f39b25b..1714aeb2a9 100644 --- a/answers/src/main/scala/fpinscala/applicative/Applicative.scala +++ b/answers/src/main/scala/fpinscala/applicative/Applicative.scala @@ -5,6 +5,9 @@ import monads.Functor import state._ import State._ import monoids._ +import language.higherKinds +import language.implicitConversions + trait Applicative[F[_]] extends Functor[F] { // `map2` is implemented by first currying `f` so we get a function diff --git a/answers/src/main/scala/fpinscala/iomonad/BindTest.scala b/answers/src/main/scala/fpinscala/iomonad/BindTest.scala index f249fe5d3d..803d0cc2fd 100644 --- a/answers/src/main/scala/fpinscala/iomonad/BindTest.scala +++ b/answers/src/main/scala/fpinscala/iomonad/BindTest.scala @@ -1,5 +1,8 @@ package fpinscala.iomonad +import language.higherKinds +import language.postfixOps + object BindTest extends App { def timeit(n: Int)(task: => Unit): Unit = { diff --git a/answers/src/main/scala/fpinscala/iomonad/IO.scala b/answers/src/main/scala/fpinscala/iomonad/IO.scala index 6994bd81e2..47a1d34349 100644 --- a/answers/src/main/scala/fpinscala/iomonad/IO.scala +++ b/answers/src/main/scala/fpinscala/iomonad/IO.scala @@ -1,5 +1,9 @@ package fpinscala.iomonad +import scala.io.StdIn.readLine +import language.higherKinds +import language.postfixOps + object IO0 { /* diff --git a/answers/src/main/scala/fpinscala/iomonad/Monad.scala b/answers/src/main/scala/fpinscala/iomonad/Monad.scala index 613901f678..52b35e2883 100644 --- a/answers/src/main/scala/fpinscala/iomonad/Monad.scala +++ b/answers/src/main/scala/fpinscala/iomonad/Monad.scala @@ -1,6 +1,7 @@ package fpinscala.iomonad import language.higherKinds // Disable warnings for type constructor polymorphism +import language.implicitConversions trait Functor[F[_]] { def map[A,B](a: F[A])(f: A => B): F[B] diff --git a/answers/src/main/scala/fpinscala/iomonad/package.scala b/answers/src/main/scala/fpinscala/iomonad/package.scala index 0fd80d4d50..29c2b6e062 100644 --- a/answers/src/main/scala/fpinscala/iomonad/package.scala +++ b/answers/src/main/scala/fpinscala/iomonad/package.scala @@ -1,5 +1,7 @@ package fpinscala +import language.higherKinds + package object iomonad { import fpinscala.parallelism.Nonblocking._ diff --git a/answers/src/main/scala/fpinscala/monads/Monad.scala b/answers/src/main/scala/fpinscala/monads/Monad.scala index 662421eb26..f6e34cbf05 100644 --- a/answers/src/main/scala/fpinscala/monads/Monad.scala +++ b/answers/src/main/scala/fpinscala/monads/Monad.scala @@ -6,6 +6,8 @@ import testing._ import parallelism._ import state._ import parallelism.Par._ +import language.higherKinds + trait Functor[F[_]] { def map[A,B](fa: F[A])(f: A => B): F[B] diff --git a/answers/src/main/scala/fpinscala/monoids/Monoid.scala b/answers/src/main/scala/fpinscala/monoids/Monoid.scala index c698a44775..66721e2d62 100644 --- a/answers/src/main/scala/fpinscala/monoids/Monoid.scala +++ b/answers/src/main/scala/fpinscala/monoids/Monoid.scala @@ -2,6 +2,7 @@ package fpinscala.monoids import fpinscala.parallelism.Nonblocking._ import fpinscala.parallelism.Nonblocking.Par.toParOps // infix syntax for `Par.map`, `Par.flatMap`, etc +import language.higherKinds trait Monoid[A] { def op(a1: A, a2: A): A diff --git a/answers/src/main/scala/fpinscala/parallelism/Nonblocking.scala b/answers/src/main/scala/fpinscala/parallelism/Nonblocking.scala index 49e6cc3a93..dca2377d4e 100644 --- a/answers/src/main/scala/fpinscala/parallelism/Nonblocking.scala +++ b/answers/src/main/scala/fpinscala/parallelism/Nonblocking.scala @@ -2,6 +2,7 @@ package fpinscala.parallelism import java.util.concurrent.{Callable, CountDownLatch, ExecutorService} import java.util.concurrent.atomic.AtomicReference +import language.implicitConversions object Nonblocking { diff --git a/answers/src/main/scala/fpinscala/parallelism/Par.scala b/answers/src/main/scala/fpinscala/parallelism/Par.scala index bc296ac963..bb0921650c 100644 --- a/answers/src/main/scala/fpinscala/parallelism/Par.scala +++ b/answers/src/main/scala/fpinscala/parallelism/Par.scala @@ -1,6 +1,8 @@ package fpinscala.parallelism import java.util.concurrent._ +import language.implicitConversions + object Par { type Par[A] = ExecutorService => Future[A] diff --git a/answers/src/main/scala/fpinscala/parsing/JSON.scala b/answers/src/main/scala/fpinscala/parsing/JSON.scala index 6a614cea54..a6630af033 100644 --- a/answers/src/main/scala/fpinscala/parsing/JSON.scala +++ b/answers/src/main/scala/fpinscala/parsing/JSON.scala @@ -1,5 +1,8 @@ package fpinscala.parsing +import language.higherKinds +import language.implicitConversions + trait JSON object JSON { diff --git a/answers/src/main/scala/fpinscala/parsing/Parsers.scala b/answers/src/main/scala/fpinscala/parsing/Parsers.scala index 5069d22deb..5238d1c104 100644 --- a/answers/src/main/scala/fpinscala/parsing/Parsers.scala +++ b/answers/src/main/scala/fpinscala/parsing/Parsers.scala @@ -4,6 +4,8 @@ import java.util.regex._ import scala.util.matching.Regex import fpinscala.testing._ import fpinscala.testing.Prop._ +import language.higherKinds +import language.implicitConversions trait Parsers[Parser[+_]] { self => // so inner classes may call methods of trait def run[A](p: Parser[A])(input: String): Either[ParseError,A] diff --git a/answers/src/main/scala/fpinscala/streamingio/MonadCatch.scala b/answers/src/main/scala/fpinscala/streamingio/MonadCatch.scala index e68ae98a1b..b292fe543f 100644 --- a/answers/src/main/scala/fpinscala/streamingio/MonadCatch.scala +++ b/answers/src/main/scala/fpinscala/streamingio/MonadCatch.scala @@ -2,6 +2,8 @@ package fpinscala.streamingio import fpinscala.iomonad._ +import language.higherKinds + /* * A context in which exceptions can be caught and * thrown. diff --git a/answers/src/main/scala/fpinscala/streamingio/Partial.scala b/answers/src/main/scala/fpinscala/streamingio/Partial.scala index 40edc8c358..4ead887007 100644 --- a/answers/src/main/scala/fpinscala/streamingio/Partial.scala +++ b/answers/src/main/scala/fpinscala/streamingio/Partial.scala @@ -1,5 +1,7 @@ package fpinscala.streamingio +import language.higherKinds + /* * A context in which exceptions can be caught and * thrown. diff --git a/answers/src/main/scala/fpinscala/streamingio/StreamingIO.scala b/answers/src/main/scala/fpinscala/streamingio/StreamingIO.scala index ed4c7d14a0..d11903a0a6 100644 --- a/answers/src/main/scala/fpinscala/streamingio/StreamingIO.scala +++ b/answers/src/main/scala/fpinscala/streamingio/StreamingIO.scala @@ -1,6 +1,9 @@ package fpinscala.streamingio import fpinscala.iomonad.{IO,Monad,Free,unsafePerformIO} +import language.implicitConversions +import language.higherKinds +import language.postfixOps object ImperativeAndLazyIO { diff --git a/answers/src/main/scala/fpinscala/streamingio/These.scala b/answers/src/main/scala/fpinscala/streamingio/These.scala index 18b81ebd7c..ade1a0bea7 100644 --- a/answers/src/main/scala/fpinscala/streamingio/These.scala +++ b/answers/src/main/scala/fpinscala/streamingio/These.scala @@ -1,5 +1,7 @@ package fpinscala.streamingio +import language.postfixOps + /* Data type representing either A, B, or both A and B. */ trait These[+A,+B] { import These._ diff --git a/answers/src/main/scala/fpinscala/testing/Exhaustive.scala b/answers/src/main/scala/fpinscala/testing/Exhaustive.scala index 9235e684f1..476d71aa9f 100644 --- a/answers/src/main/scala/fpinscala/testing/Exhaustive.scala +++ b/answers/src/main/scala/fpinscala/testing/Exhaustive.scala @@ -1,5 +1,8 @@ package fpinscala.testing.exhaustive +import language.implicitConversions +import language.postfixOps + /* This source file contains the answers to the last two exercises in the section "Test Case Minimization" of chapter 8 on property-based testing. diff --git a/answers/src/main/scala/fpinscala/testing/Gen.scala b/answers/src/main/scala/fpinscala/testing/Gen.scala index 9a0637c2af..b8141f5fb8 100644 --- a/answers/src/main/scala/fpinscala/testing/Gen.scala +++ b/answers/src/main/scala/fpinscala/testing/Gen.scala @@ -7,6 +7,8 @@ import fpinscala.parallelism.Par.Par import Gen._ import Prop._ import java.util.concurrent.{Executors,ExecutorService} +import language.postfixOps +import language.implicitConversions case class Prop(run: (MaxSize,TestCases,RNG) => Result) { def &&(p: Prop) = Prop { diff --git a/exercises/src/main/scala/fpinscala/applicative/Applicative.scala b/exercises/src/main/scala/fpinscala/applicative/Applicative.scala index b6608e4e48..f1caa3a775 100644 --- a/exercises/src/main/scala/fpinscala/applicative/Applicative.scala +++ b/exercises/src/main/scala/fpinscala/applicative/Applicative.scala @@ -6,6 +6,8 @@ import state._ import State._ import StateUtil._ // defined at bottom of this file import monoids._ +import language.higherKinds +import language.implicitConversions trait Applicative[F[_]] extends Functor[F] { diff --git a/exercises/src/main/scala/fpinscala/iomonad/IO.scala b/exercises/src/main/scala/fpinscala/iomonad/IO.scala index 53979d53a2..284116f204 100644 --- a/exercises/src/main/scala/fpinscala/iomonad/IO.scala +++ b/exercises/src/main/scala/fpinscala/iomonad/IO.scala @@ -1,5 +1,9 @@ package fpinscala.iomonad +import language.postfixOps +import language.higherKinds +import scala.io.StdIn.readLine + object IO0 { /* diff --git a/exercises/src/main/scala/fpinscala/iomonad/Monad.scala b/exercises/src/main/scala/fpinscala/iomonad/Monad.scala index 129c0928a3..3727d54cda 100644 --- a/exercises/src/main/scala/fpinscala/iomonad/Monad.scala +++ b/exercises/src/main/scala/fpinscala/iomonad/Monad.scala @@ -1,6 +1,7 @@ package fpinscala.iomonad import language.higherKinds // Disable warnings for type constructor polymorphism +import language.implicitConversions trait Functor[F[_]] { def map[A,B](a: F[A])(f: A => B): F[B] diff --git a/exercises/src/main/scala/fpinscala/iomonad/package.scala b/exercises/src/main/scala/fpinscala/iomonad/package.scala index 0fd80d4d50..29c2b6e062 100644 --- a/exercises/src/main/scala/fpinscala/iomonad/package.scala +++ b/exercises/src/main/scala/fpinscala/iomonad/package.scala @@ -1,5 +1,7 @@ package fpinscala +import language.higherKinds + package object iomonad { import fpinscala.parallelism.Nonblocking._ diff --git a/exercises/src/main/scala/fpinscala/monads/Monad.scala b/exercises/src/main/scala/fpinscala/monads/Monad.scala index 242423e10e..f13552f216 100644 --- a/exercises/src/main/scala/fpinscala/monads/Monad.scala +++ b/exercises/src/main/scala/fpinscala/monads/Monad.scala @@ -6,6 +6,8 @@ import testing._ import parallelism._ import state._ import parallelism.Par._ +import language.higherKinds + trait Functor[F[_]] { def map[A,B](fa: F[A])(f: A => B): F[B] diff --git a/exercises/src/main/scala/fpinscala/monoids/Monoid.scala b/exercises/src/main/scala/fpinscala/monoids/Monoid.scala index 42991c1e60..c54be56fa7 100644 --- a/exercises/src/main/scala/fpinscala/monoids/Monoid.scala +++ b/exercises/src/main/scala/fpinscala/monoids/Monoid.scala @@ -2,6 +2,7 @@ package fpinscala.monoids import fpinscala.parallelism.Nonblocking._ import fpinscala.parallelism.Nonblocking.Par.toParOps // infix syntax for `Par.map`, `Par.flatMap`, etc +import language.higherKinds trait Monoid[A] { def op(a1: A, a2: A): A diff --git a/exercises/src/main/scala/fpinscala/parallelism/Nonblocking.scala b/exercises/src/main/scala/fpinscala/parallelism/Nonblocking.scala index 0c19c8320b..4cddf5148b 100644 --- a/exercises/src/main/scala/fpinscala/parallelism/Nonblocking.scala +++ b/exercises/src/main/scala/fpinscala/parallelism/Nonblocking.scala @@ -2,6 +2,7 @@ package fpinscala.parallelism import java.util.concurrent.{Callable, CountDownLatch, ExecutorService} import java.util.concurrent.atomic.AtomicReference +import language.implicitConversions object Nonblocking { diff --git a/exercises/src/main/scala/fpinscala/parallelism/Par.scala b/exercises/src/main/scala/fpinscala/parallelism/Par.scala index 0defe2c878..f790e48c78 100644 --- a/exercises/src/main/scala/fpinscala/parallelism/Par.scala +++ b/exercises/src/main/scala/fpinscala/parallelism/Par.scala @@ -1,6 +1,7 @@ package fpinscala.parallelism import java.util.concurrent._ +import language.implicitConversions object Par { type Par[A] = ExecutorService => Future[A] diff --git a/exercises/src/main/scala/fpinscala/parsing/Parsers.scala b/exercises/src/main/scala/fpinscala/parsing/Parsers.scala index ac07e731e5..ec4b25e2aa 100644 --- a/exercises/src/main/scala/fpinscala/parsing/Parsers.scala +++ b/exercises/src/main/scala/fpinscala/parsing/Parsers.scala @@ -1,9 +1,6 @@ package fpinscala.parsing -import java.util.regex._ -import scala.util.matching.Regex -import fpinscala.testing._ -import fpinscala.testing.Prop._ +import language.higherKinds trait Parsers[Parser[+_]] { self => // so inner classes may call methods of trait diff --git a/exercises/src/main/scala/fpinscala/streamingio/MonadCatch.scala b/exercises/src/main/scala/fpinscala/streamingio/MonadCatch.scala index e68ae98a1b..1d0f752a27 100644 --- a/exercises/src/main/scala/fpinscala/streamingio/MonadCatch.scala +++ b/exercises/src/main/scala/fpinscala/streamingio/MonadCatch.scala @@ -1,6 +1,7 @@ package fpinscala.streamingio import fpinscala.iomonad._ +import language.higherKinds /* * A context in which exceptions can be caught and diff --git a/exercises/src/main/scala/fpinscala/streamingio/StreamingIO.scala b/exercises/src/main/scala/fpinscala/streamingio/StreamingIO.scala index 17e9db59e4..bd47215f54 100644 --- a/exercises/src/main/scala/fpinscala/streamingio/StreamingIO.scala +++ b/exercises/src/main/scala/fpinscala/streamingio/StreamingIO.scala @@ -1,6 +1,9 @@ package fpinscala.streamingio import fpinscala.iomonad.{IO,Monad,Free,unsafePerformIO} +import language.implicitConversions +import language.higherKinds +import language.postfixOps object ImperativeAndLazyIO { diff --git a/project/Build.scala b/project/Build.scala index 4496a084a2..39477d380e 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -3,7 +3,7 @@ import Keys._ object FPInScalaBuild extends Build { val opts = Project.defaultSettings ++ Seq( - scalaVersion := "2.11.5", + scalaVersion := "2.11.7", resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" )