From 753f8940d340443201d9f69d78d5a6f615349958 Mon Sep 17 00:00:00 2001 From: Daniel Slapman Date: Mon, 17 Sep 2018 23:45:26 +0300 Subject: [PATCH] Add `Pure` instance for Future --- .../src/main/scala/alleycats/std/all.scala | 3 ++- .../src/main/scala/alleycats/std/future.scala | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 alleycats-core/src/main/scala/alleycats/std/future.scala diff --git a/alleycats-core/src/main/scala/alleycats/std/all.scala b/alleycats-core/src/main/scala/alleycats/std/all.scala index e7eb304881c..9905da41e20 100644 --- a/alleycats-core/src/main/scala/alleycats/std/all.scala +++ b/alleycats-core/src/main/scala/alleycats/std/all.scala @@ -9,5 +9,6 @@ import export._ OptionInstances, SetInstances, TryInstances, - IterableInstances + IterableInstances, + FutureInstances ) object all extends LegacySetInstances with LegacyTryInstances with LegacyIterableInstances with MapInstances diff --git a/alleycats-core/src/main/scala/alleycats/std/future.scala b/alleycats-core/src/main/scala/alleycats/std/future.scala new file mode 100644 index 00000000000..44fa4a192e4 --- /dev/null +++ b/alleycats-core/src/main/scala/alleycats/std/future.scala @@ -0,0 +1,17 @@ +package alleycats +package std + +import export._ + +import scala.concurrent.Future + +@reexports(FutureInstances) +object future + +object FutureInstances { + @export(Orphan) + implicit val exportFuturePure: Pure[Future] = + new Pure[Future] { + override def pure[A](a: A): Future[A] = Future.successful(a) + } +} \ No newline at end of file