This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def toIterator[R, E, A]( | |
| stream: ZStream[R, E, A] | |
| ): ZManaged[R, Nothing, Iterator[Either[E, A]]] = { | |
| /* | |
| * Internal state of a Iterator pulling from a ZStream | |
| * | |
| * It starts as Running | |
| * | |
| * when Running , on pull (hasNext), pull the ZStream and switch to Closed or Value | |
| * when Value , on consume (next), return the Value and switch to Running |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed trait Path | |
| case class Field(name: String, child: Option[Path]) extends Path { | |
| override def toString: String = child match { | |
| case None => name | |
| case Some(path) => s"$name.$path" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ToIterator private (runtime: Runtime[Any]) { | |
| def unsafeCreate[V](q: UIO[stream.Stream[_,V]]): Iterator[V] = | |
| new Iterator[V] { | |
| import ToIterator._ | |
| var state: State[V] = Running | |
| val synchronousBlockQueue: BlockingQueue[ValueOrClosed[V]] = new SynchronousQueue[ValueOrClosed[V]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object ZioToSparkIterator { | |
| def toIterator[E, A](q: UIO[stream.Stream[E, A]]): Iterator[Either[E, A]] = new Iterator[Either[E, A]] { | |
| sealed trait State | |
| case object Running extends State | |
| sealed trait ValueOrClosed extends State | |
| case object Closed extends ValueOrClosed | |
| case class Value(value: Either[E, A]) extends ValueOrClosed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| implicit val qTree:DeepEqual[QTree[Unit]] = DeepEqual.anyDeepEqual | |
| //DeepEqual.gen[DescribeLong] | |
| DeepEqual.gen[ParkaAnalysis].explainNotEqual(pa,paFromJson).foreach(println) | |
| assert(pa == paFromJson) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Person(name: String, age: Int) | |
| { | |
| val n:Option[String] = Some("toto") | |
| val a:Option[Int] = None | |
| val p:Option[Person] = Person.apply.app(name = n, age = a) | |
| } | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2017-2019 John A. De Goes and the ZIO Contributors | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2017-2019 John A. De Goes and the ZIO Contributors | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2017-2019 John A. De Goes and the ZIO Contributors | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/core/shared/src/main/scala/scalaz/zio/clock/package.scala b/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
| index 5691082e..33cfcb61 100644 | |
| --- a/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
| +++ b/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
| @@ -17,28 +17,37 @@ | |
| package scalaz.zio | |
| import scalaz.zio.duration.Duration | |
| - | |
| import java.util.concurrent.TimeUnit |