From 1d5a51aa386ec209b47148ecc5a1a56c48fff5f6 Mon Sep 17 00:00:00 2001 From: danslapman Date: Wed, 19 Sep 2018 17:36:50 +0300 Subject: [PATCH] Add `Pure` instance for Future (#2510) --- .../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 e7eb304881..9905da41e2 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 0000000000..1c314935fd --- /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) + } +}