├── .devcontainer └── devcontainer.json ├── .git-blame-ignore-revs ├── .github ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── auto-approve.yml │ ├── ci.yml │ ├── release-drafter.yml │ └── scala-steward.yml ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── .jvmopts ├── .nvmrc ├── .scala-steward.conf ├── .scalafmt.conf ├── .vscode └── settings.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ZIO.png ├── benchmarks ├── README.md └── src │ └── main │ └── scala │ └── zio │ ├── ArrayFillBenchmark.scala │ ├── AsyncConcurrentBenchmarks.scala │ ├── AsyncResumptionBenchmark.scala │ ├── AwaitBenchmark.scala │ ├── BenchmarkUtil.scala │ ├── BlockingBenchmark.scala │ ├── BroadFlatMapBenchmark.scala │ ├── BubbleSortBenchmark.scala │ ├── CollectAllBenchmark.scala │ ├── ConfigProviderBenchmark.scala │ ├── CustomExecutorBenchmark.scala │ ├── DeepAsyncBenchmark.scala │ ├── DeepAttemptBenchmark.scala │ ├── EmptyRaceBenchmark.scala │ ├── FiberRefBenchmarks.scala │ ├── FiberRefsBenchmark.scala │ ├── ForEachBenchmark.scala │ ├── ForkAllBenchmark.scala │ ├── ForkAllDiscardBenchmark.scala │ ├── ForkInterruptBenchmark.scala │ ├── ForkJoinBenchmark.scala │ ├── GenBenchmarks.scala │ ├── HubBenchmark.scala │ ├── LeftBindBenchmark.scala │ ├── MapBenchmark.scala │ ├── NarrowFlatMapBenchmark.scala │ ├── NewEncodingBenchmark.scala │ ├── ParallelMergeSortBenchmark.scala │ ├── PromiseBenchmarks.scala │ ├── QueueBackPressureBenchmark.scala │ ├── QueueChunkBenchmark.scala │ ├── QueueParallelBenchmark.scala │ ├── QueueSequentialBenchmark.scala │ ├── RechunkBenchmark.scala │ ├── RegionBenchmark.scala │ ├── ScopeBenchmark.scala │ ├── ShallowAttemptBenchmark.scala │ ├── StreamBenchmarks.scala │ ├── StreamParBenchmark.scala │ ├── UnsafeRunBenchmark.scala │ ├── ZEnvironmentBenchmark.scala │ ├── ZIOArray.scala │ ├── chunks │ ├── ArrayBenchmarks.scala │ ├── ChainBenchmarks.scala │ ├── ChunkAppendBenchmarks.scala │ ├── ChunkConcatBenchmarks.scala │ ├── ChunkCreationBenchmarks.scala │ ├── ChunkFindBenchmarks.scala │ ├── ChunkFlatMapBenchmarks.scala │ ├── ChunkFoldBenchmarks.scala │ ├── ChunkIndexedSeqComparison.scala │ ├── ChunkMapBenchmarks.scala │ ├── ChunkPrependBenchmarks.scala │ ├── ChunkUpdateBenchmarks.scala │ └── MixedChunkBenchmarks.scala │ ├── internal │ ├── BenchQueueType.scala │ ├── BenchUtils.scala │ ├── ConcurrentWeakHashSetBenchmark.scala │ ├── ForeachPar_Benchmark.scala │ ├── JCToolsQueue.scala │ ├── JucBlockingQueue.scala │ ├── MergeAllParBenchmark.scala │ ├── MetricBenchmark.scala │ ├── NotThreadSafeQueue.scala │ ├── OfferBenchmark.scala │ ├── OneElementConcQueueNoMetric.scala │ ├── OneElementQueueConcBenchmark.scala │ ├── OneElementQueueSeqBenchmark.scala │ ├── PingPongBenchmark.scala │ ├── PollBenchmark.scala │ ├── ProducerConsumerBenchmark.scala │ ├── ReduceAllParBenchmark.scala │ ├── RingBufferMethodDispatchBenchmark.scala │ ├── RoundtripBenchmark.scala │ ├── WeakConcurrentBagBenchmark.scala │ └── ZSchedulerBenchmarks.scala │ ├── metrics │ └── MetricBenchmarks.scala │ ├── stm │ ├── STMFlatMapBenchmark.scala │ ├── STMRetryBenchmark.scala │ ├── SemaphoreBenchmark.scala │ ├── SingleRefBenchmark.scala │ ├── TArrayOpsBenchmarks.scala │ ├── TMapContentionBenchmarks.scala │ ├── TMapOpsBenchmarks.scala │ ├── TReentrantLockBenchmark.scala │ └── TSetOpsBenchmarks.scala │ └── test │ └── GenBenchmark.scala ├── build.sbt ├── concurrent └── src │ ├── main │ └── scala │ │ └── zio │ │ └── concurrent │ │ ├── ConcurrentMap.scala │ │ ├── ConcurrentSet.scala │ │ ├── CountdownLatch.scala │ │ ├── CyclicBarrier.scala │ │ ├── MVar.scala │ │ └── ReentrantLock.scala │ └── test │ └── scala │ └── zio │ └── concurrent │ ├── ConcurrentMapSpec.scala │ ├── ConcurrentSetSpec.scala │ ├── CountdownLatchSpec.scala │ ├── CyclicBarrierSpec.scala │ ├── MVarSpec.scala │ └── ReentrantLockSpec.scala ├── core-tests ├── js │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ ├── internal │ │ └── OneShotSpec.scala │ │ └── interop │ │ └── JSSpec.scala ├── jvm-native │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ ├── BlockingSpec.scala │ │ ├── CancelableFutureSpecJVM.scala │ │ ├── ClockSpecJVM.scala │ │ ├── FiberRefSpecJvm.scala │ │ ├── RTSSpec.scala │ │ ├── RuntimeSpec.scala │ │ ├── RuntimeSpecJVM.scala │ │ ├── SystemSpec.scala │ │ ├── ZIOSpecJVM.scala │ │ └── internal │ │ ├── OneShotSpec.scala │ │ └── SingleThreadedRingBufferSpec.scala ├── jvm │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ ├── HubConcurrencyTests.scala │ │ ├── MetricsSpec.scala │ │ ├── SerializableSpec.scala │ │ ├── autowire │ │ └── LargeAutoWireSpec.scala │ │ ├── internal │ │ ├── BoundedHubArbConcurrencyTests.scala │ │ ├── BoundedHubPow2ConcurrencyTests.scala │ │ ├── BoundedHubSingleConcurrencyTests.scala │ │ ├── ConcurrentWeakHashSetSpecJVM.scala │ │ ├── MutableConcurrentQueueSpecJVM.scala │ │ ├── OneElementConcurrentQueueConcurrencyTests.scala │ │ ├── RingBufferArbConcurrencyTests.scala │ │ ├── RingBufferPow2ConcurrencyTests.scala │ │ ├── UnboundedHubConcurrencyTests.scala │ │ └── UpdateOrderLinkedMapConcurrencyTests.scala │ │ ├── interop │ │ └── JavaSpec.scala │ │ └── stm │ │ ├── ZSTMConcurrencyTests.scala │ │ └── ZSTMJvmSpec.scala └── shared │ └── src │ └── test │ ├── scala-2.13 │ ├── ChunkBuilderVersionSpecific.scala │ └── ChunkSpecVersionSpecific.scala │ ├── scala-2 │ ├── scala │ │ └── annotation │ │ │ └── experimental.scala │ └── zio │ │ ├── HasNoScopeSpec.scala │ │ └── internal │ │ └── stacktracer │ │ └── TracerSpec.scala │ ├── scala-3 │ └── zio │ │ ├── .internal │ │ └── .stacktracer │ │ │ └── TracerSpec.scala │ │ ├── AssertTrueWithMacroCodeSpec.scala │ │ ├── ExperimentalSpec.scala │ │ ├── HasNoScopeSpec.scala │ │ ├── InlineScopeTestSpec.scala │ │ ├── IntersectionEnvSpec.scala │ │ ├── OpaqueTypeTagsSpec.scala │ │ ├── ProvideSpec.scala │ │ └── UnsafeSpecVersionSpecific.scala │ └── scala │ ├── REPLSpec.scala │ └── zio │ ├── BitChunkByteSpec.scala │ ├── BitChunkIntSpec.scala │ ├── BitChunkLongSpec.scala │ ├── BracketTypeInferrenceSpec.scala │ ├── CachedSpec.scala │ ├── CanFailSpec.scala │ ├── CancelableFutureSpec.scala │ ├── CauseSpec.scala │ ├── ChunkAsStringSpec.scala │ ├── ChunkBufferSpec.scala │ ├── ChunkBuilderSpec.scala │ ├── ChunkPackedBooleanSpec.scala │ ├── ChunkSpec.scala │ ├── ClockSpec.scala │ ├── ConfigProviderAppArgsSpec.scala │ ├── ConfigProviderEnvSpec.scala │ ├── ConfigProviderSpec.scala │ ├── ConfigSpec.scala │ ├── DifferSpec.scala │ ├── DurationSpec.scala │ ├── ExecutorSpec.scala │ ├── FiberIdSpec.scala │ ├── FiberRefSpec.scala │ ├── FiberRefsSpec.scala │ ├── FiberRuntimeSpec.scala │ ├── FiberSpec.scala │ ├── HubSpec.scala │ ├── ImportlessSpec.scala │ ├── IsReloadableSpec.scala │ ├── LatchOps.scala │ ├── LoggingSpec.scala │ ├── NonEmptyChunkSpec.scala │ ├── PromiseSpec.scala │ ├── QueueSpec.scala │ ├── RandomSpec.scala │ ├── RefSpec.scala │ ├── RefSynchronizedSpec.scala │ ├── ReloadableSpec.scala │ ├── RuntimeBootstrapTests.scala │ ├── RuntimeFlagsSpec.scala │ ├── ScheduleSpec.scala │ ├── ScopeSpec.scala │ ├── ScopedRefSpec.scala │ ├── SemaphoreSpec.scala │ ├── StackTracesSpec.scala │ ├── SupervisorSpec.scala │ ├── TagCorrectnessSpec.scala │ ├── TaggedSpec.scala │ ├── ThreadLocalBridgeSpec.scala │ ├── UnsafeSpec.scala │ ├── ZEnvironmentIssuesSpec.scala │ ├── ZEnvironmentSpec.scala │ ├── ZIOAppSpec.scala │ ├── ZIOAspectSpec.scala │ ├── ZIOBaseSpec.scala │ ├── ZIOLazinessSpec.scala │ ├── ZIOSpec.scala │ ├── ZKeyedPoolSpec.scala │ ├── ZLayerDerivationSpec.scala │ ├── ZLayerSpec.scala │ ├── ZPoolSpec.scala │ ├── ZStateSpec.scala │ ├── autowire │ ├── AutoWireSpec.scala │ └── InjectParameterizedServicesSpec.scala │ ├── internal │ ├── ConcurrentWeakHashSetSpec.scala │ ├── FastListSpec.scala │ ├── HubSpec.scala │ ├── IsFatalSpec.scala │ ├── MutableConcurrentQueueSpec.scala │ ├── PartitionedLinkedQueueSpec.scala │ ├── PartitionedRingBufferSpec.scala │ ├── PinchableArraySpec.scala │ ├── StackSpec.scala │ ├── UpdateOrderLinkedMapSpec.scala │ ├── WeakConcurrentBagSpec.scala │ ├── metrics │ │ ├── ConcurrentSummarySpec.scala │ │ └── MetricListenerSpec.scala │ └── stacktracer │ │ └── TracerUtilsSpec.scala │ ├── metrics │ ├── MetricSpec.scala │ ├── MetricsSpec.scala │ └── PollingMetricSpec.scala │ └── stm │ ├── STMLazinessSpec.scala │ ├── TArraySpec.scala │ ├── THubSpec.scala │ ├── TMapSpec.scala │ ├── TPriorityQueueSpec.scala │ ├── TQueueSpec.scala │ ├── TRandomSpec.scala │ ├── TReentrantLockSpec.scala │ ├── TSemaphoreSpec.scala │ ├── TSetSpec.scala │ └── ZSTMSpec.scala ├── core ├── js-native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── ClockSyntaxPlatformSpecific.scala ├── js │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ ├── ChunkPlatformSpecific.scala │ │ ├── ClockPlatformSpecific.scala │ │ ├── ExecutorPlatformSpecific.scala │ │ ├── FiberPlatformSpecific.scala │ │ ├── QueuePlatformSpecific.scala │ │ ├── RuntimePlatformSpecific.scala │ │ ├── Scheduler.scala │ │ ├── SystemPlatformSpecific.scala │ │ ├── TaskPlatformSpecific.scala │ │ ├── ZIOAppPlatformSpecific.scala │ │ ├── ZIOPlatformSpecific.scala │ │ ├── internal │ │ ├── Blocking.scala │ │ ├── BoundedHubArb.scala │ │ ├── BoundedHubPow2.scala │ │ ├── BoundedHubSingle.scala │ │ ├── DefaultExecutors.scala │ │ ├── OneElementConcurrentQueue.scala │ │ ├── OneShot.scala │ │ ├── PlatformSpecific.scala │ │ ├── RingBuffer.scala │ │ ├── Sync.scala │ │ ├── UnboundedHub.scala │ │ ├── WeakConcurrentBagGc.scala │ │ └── metrics │ │ │ └── ConcurrentMetricHooksPlatformSpecific.scala │ │ └── stm │ │ └── ZSTMLockSupport.scala ├── jvm-native │ └── src │ │ └── main │ │ ├── scala-2 │ │ └── zio │ │ │ └── stm │ │ │ └── ZSTMLockSupport.scala │ │ ├── scala-3 │ │ └── zio │ │ │ └── stm │ │ │ └── ZSTMLockSupport.scala │ │ └── scala │ │ └── zio │ │ ├── ChunkPlatformSpecific.scala │ │ ├── ClockPlatformSpecific.scala │ │ ├── ExecutorPlatformSpecific.scala │ │ ├── Scheduler.scala │ │ ├── SystemPlatformSpecific.scala │ │ ├── ZIOAppPlatformSpecific.scala │ │ ├── ZIOPlatformSpecific.scala │ │ └── internal │ │ ├── Blocking.scala │ │ ├── BoundedHubArb.scala │ │ ├── BoundedHubPow2.scala │ │ ├── BoundedHubSingle.scala │ │ ├── DefaultExecutors.scala │ │ ├── NamedThreadFactory.scala │ │ ├── OneElementConcurrentQueue.scala │ │ ├── OneShot.scala │ │ ├── Sync.scala │ │ ├── UnboundedHub.scala │ │ ├── WeakConcurrentBagGc.scala │ │ ├── ZScheduler.scala │ │ └── metrics │ │ └── ConcurrentMetricHooksPlatformSpecific.scala ├── jvm │ └── src │ │ └── main │ │ ├── java │ │ └── zio │ │ │ └── internal │ │ │ └── MutableQueueFieldsPadding.java │ │ ├── resources │ │ └── META-INF │ │ │ └── native-image │ │ │ └── dev.zio │ │ │ └── zio │ │ │ ├── native-image.properties │ │ │ └── sun-misc-signal-proxy-config.json │ │ └── scala │ │ └── zio │ │ ├── ClockSyntaxPlatformSpecific.scala │ │ ├── FiberPlatformSpecific.scala │ │ ├── QueuePlatformSpecific.scala │ │ ├── RuntimePlatformSpecific.scala │ │ ├── TaskPlatformSpecific.scala │ │ ├── ZIOPlatformSpecificJVM.scala │ │ ├── internal │ │ ├── LoomSupport.scala │ │ ├── PlatformSpecific.scala │ │ ├── RingBuffer.scala │ │ ├── Signal.scala │ │ └── metrics │ │ │ └── AddersVersionSpecific.scala │ │ ├── interop │ │ └── javaz.scala │ │ └── metrics │ │ └── jvm │ │ ├── BufferPools.scala │ │ ├── ClassLoading.scala │ │ ├── DefaultJvmMetrics.scala │ │ ├── GarbageCollector.scala │ │ ├── JvmMetricsSchedule.scala │ │ ├── MemoryAllocation.scala │ │ ├── MemoryPools.scala │ │ ├── Standard.scala │ │ ├── Thread.scala │ │ └── VersionInfo.scala ├── native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ ├── FiberPlatformSpecific.scala │ │ ├── QueuePlatformSpecific.scala │ │ ├── RuntimePlatformSpecific.scala │ │ ├── TaskPlatformSpecific.scala │ │ ├── ZIOPlatformSpecificJVM.scala │ │ └── internal │ │ ├── PlatformSpecific.scala │ │ ├── RingBuffer.scala │ │ └── metrics │ │ └── AddersVersionSpecific.scala └── shared │ └── src │ └── main │ ├── scala-2.12 │ └── zio │ │ ├── BuildFromCompat.scala │ │ ├── ChunkBuilder.scala │ │ ├── ChunkCanBuildFrom.scala │ │ ├── ChunkFactory.scala │ │ ├── ChunkLike.scala │ │ ├── internal │ │ └── MutableSetCompat.scala │ │ └── stm │ │ └── ZSTMUtils.scala │ ├── scala-2.13+ │ └── zio │ │ ├── BuildFromCompat.scala │ │ ├── ChunkBuilder.scala │ │ ├── ChunkFactory.scala │ │ ├── ChunkLike.scala │ │ ├── internal │ │ └── MutableSetCompat.scala │ │ └── stm │ │ └── ZSTMUtils.scala │ ├── scala-2 │ └── zio │ │ ├── =!=.scala │ │ ├── CanFail.scala │ │ ├── HasNoScopeCompanionVersionSpecific.scala │ │ ├── IntersectionTypeCompat.scala │ │ ├── IsReloadableVersionSpecific.scala │ │ ├── ServiceTagVersionSpecific.scala │ │ ├── UnsafeVersionSpecific.scala │ │ ├── ZIOAppVersionSpecific.scala │ │ ├── ZIOCompanionVersionSpecific.scala │ │ ├── ZIOVersionSpecific.scala │ │ ├── ZLayerCompanionVersionSpecific.scala │ │ ├── ZLayerVersionSpecific.scala │ │ └── internal │ │ └── macros │ │ ├── CleanCodePrinter.scala │ │ ├── IsReloadableMacros.scala │ │ ├── LayerMacroUtils.scala │ │ ├── LayerMacros.scala │ │ ├── ZLayerDerivationMacros.scala │ │ └── ZLayerMakeMacros.scala │ ├── scala-3 │ └── zio │ │ ├── =!=.scala │ │ ├── CanFail.scala │ │ ├── Experimental.scala │ │ ├── HasNoScopeCompanionVersionSpecific.scala │ │ ├── IntersectionTypeCompat.scala │ │ ├── IsReloadableVersionSpecific.scala │ │ ├── ServiceTagVersionSpecific.scala │ │ ├── UnsafeVersionSpecific.scala │ │ ├── ZIOAppVersionSpecific.scala │ │ ├── ZIOCompanionVersionSpecific.scala │ │ ├── ZIOVersionSpecific.scala │ │ ├── ZLayerCompanionVersionSpecific.scala │ │ ├── ZLayerVersionSpecific.scala │ │ └── internal │ │ └── macros │ │ ├── LayerMacroUtils.scala │ │ ├── LayerMacros.scala │ │ └── ZLayerDerivationMacros.scala │ └── scala │ └── zio │ ├── Cached.scala │ ├── CancelableFuture.scala │ ├── Cause.scala │ ├── Chunk.scala │ ├── Clock.scala │ ├── Config.scala │ ├── ConfigProvider.scala │ ├── Console.scala │ ├── DefaultServices.scala │ ├── Dequeue.scala │ ├── Differ.scala │ ├── Duration.scala │ ├── EitherCompat.scala │ ├── Enqueue.scala │ ├── ExecutionStrategy.scala │ ├── Executor.scala │ ├── ExitCode.scala │ ├── Fiber.scala │ ├── FiberFailure.scala │ ├── FiberId.scala │ ├── FiberRef.scala │ ├── FiberRefs.scala │ ├── FunctionConstructor.scala │ ├── FutureTransformCompat.scala │ ├── HasNoScope.scala │ ├── Hub.scala │ ├── InterruptStatus.scala │ ├── IsReloadable.scala │ ├── IsSubtype.scala │ ├── LogAnnotation.scala │ ├── LogLevel.scala │ ├── LogSpan.scala │ ├── NonEmptyChunk.scala │ ├── NonEmptyOps.scala │ ├── NonEmptySeq.scala │ ├── Promise.scala │ ├── Queue.scala │ ├── Random.scala │ ├── Ref.scala │ ├── Reloadable.scala │ ├── Runtime.scala │ ├── RuntimeFlag.scala │ ├── RuntimeFlags.scala │ ├── Schedule.scala │ ├── Scope.scala │ ├── ScopedRef.scala │ ├── Semaphore.scala │ ├── StackTrace.scala │ ├── Supervisor.scala │ ├── System.scala │ ├── ThreadLocalBridge.scala │ ├── Trace.scala │ ├── Unsafe.scala │ ├── Unzippable.scala │ ├── UpdateRuntimeFlagsWithinPlatformSpecific.scala │ ├── VersionSpecific.scala │ ├── ZEnvironment.scala │ ├── ZIO.scala │ ├── ZIOApp.scala │ ├── ZIOAppArgs.scala │ ├── ZIOAppDefault.scala │ ├── ZIOAspect.scala │ ├── ZIOFunctionConstructor.scala │ ├── ZInputStream.scala │ ├── ZKeyedPool.scala │ ├── ZLayer.scala │ ├── ZLayerAspect.scala │ ├── ZLogger.scala │ ├── ZOutputStream.scala │ ├── ZPool.scala │ ├── ZState.scala │ ├── Zippable.scala │ ├── internal │ ├── ConcurrentWeakHashSet.scala │ ├── ExecutionMetrics.scala │ ├── FastList.scala │ ├── FiberMessage.scala │ ├── FiberRenderer.scala │ ├── FiberRunnable.scala │ ├── FiberRuntime.scala │ ├── FiberScope.scala │ ├── Hub.scala │ ├── IsFatal.scala │ ├── MutableConcurrentQueue.scala │ ├── PinchableArray.scala │ ├── Platform.scala │ ├── RingBufferArb.scala │ ├── RingBufferPow2.scala │ ├── SingleThreadedRingBuffer.scala │ ├── SpecializationHelpers.scala │ ├── Stack.scala │ ├── StackTraceBuilder.scala │ ├── UniqueKey.scala │ ├── UpdateOrderLinkedMap.scala │ ├── WeakConcurrentBag.scala │ ├── impls │ │ ├── LinkedQueue.scala │ │ ├── PartitionedLinkedQueue.scala │ │ └── PartitionedRingBuffer.scala │ ├── macros │ │ ├── DummyK.scala │ │ ├── Graph.scala │ │ ├── GraphError.scala │ │ ├── LayerBuilder.scala │ │ ├── LayerTree.scala │ │ ├── Node.scala │ │ ├── RenderedGraph.scala │ │ └── StringUtils.scala │ └── metrics │ │ ├── ConcurrentMetricHooks.scala │ │ ├── ConcurrentMetricRegistry.scala │ │ ├── MetricEventType.scala │ │ ├── MetricHook.scala │ │ └── package.scala │ ├── metrics │ ├── Metric.scala │ ├── MetricClient.scala │ ├── MetricKey.scala │ ├── MetricKeyType.scala │ ├── MetricLabel.scala │ ├── MetricListener.scala │ ├── MetricPair.scala │ ├── MetricState.scala │ ├── Metrics.scala │ └── PollingMetric.scala │ ├── package.scala │ └── stm │ ├── STM.scala │ ├── TArray.scala │ ├── TDequeue.scala │ ├── TEnqueue.scala │ ├── THub.scala │ ├── TMap.scala │ ├── TPriorityQueue.scala │ ├── TPromise.scala │ ├── TQueue.scala │ ├── TRandom.scala │ ├── TReentrantLock.scala │ ├── TRef.scala │ ├── TSemaphore.scala │ ├── TSet.scala │ ├── ZSTM.scala │ └── package.scala ├── docs ├── adopters.md ├── canfail.md ├── code-of-conduct.md ├── coding-guidelines.md ├── contributing-to-documentation.md ├── contributing-to-zio-ecosystem-projects.md ├── contributor-guidelines.md ├── ecosystem │ ├── community │ │ ├── caliban.md │ │ ├── distage.md │ │ ├── fhir-indexer.md │ │ ├── index.md │ │ ├── logstage.md │ │ ├── munit-zio.md │ │ ├── rezilience.md │ │ ├── scala-k8s.md │ │ ├── tamer.md │ │ ├── tofu-zio2-logging.md │ │ ├── tranzactio.md │ │ ├── zio-amqp.md │ │ ├── zio-apache-parquet.md │ │ ├── zio-grpc.md │ │ ├── zio-k8s.md │ │ ├── zio-kinesis.md │ │ ├── zio-nebula.md │ │ ├── zio-pulsar.md │ │ ├── zio-slick-interop.md │ │ ├── zio-temporal.md │ │ ├── zio-test-akka-http.md │ │ └── zparkio.md │ ├── compatible.md │ ├── index.mdx │ ├── officials │ │ └── index.md │ ├── templates.md │ └── tools.md ├── events │ └── index.md ├── faq.md ├── guides │ ├── index.md │ ├── interop │ │ ├── with-cats-effect.md │ │ ├── with-future.md │ │ ├── with-guava.md │ │ ├── with-java.md │ │ ├── with-javascript.md │ │ ├── with-monix.md │ │ ├── with-reactive-streams.md │ │ ├── with-scalaz-7x.md │ │ └── with-twitter.md │ ├── migrate │ │ ├── from-akka.md │ │ ├── from-cats-effect.md │ │ ├── from-monix.md │ │ └── migration-guide.md │ ├── quickstarts │ │ ├── graphql-webservice.md │ │ ├── hello-world.md │ │ └── restful-webservice.md │ └── tutorials │ │ ├── build-a-graphql-webservice.md │ │ ├── build-a-restful-webservice.md │ │ ├── create-custom-logger-for-a-zio-application.md │ │ ├── debug-a-zio-application.md │ │ ├── deploy-a-zio-application-using-docker.md │ │ ├── enable-logging-in-a-zio-application.md │ │ ├── encode-and-decode-json-data.md │ │ ├── gracefully-shutdown-zio-application.md │ │ ├── img │ │ ├── intellij-idea-new-project-1.png │ │ ├── intellij-idea-new-project-2.png │ │ ├── intellij-idea-test-runner-output.png │ │ └── vscode.jpg │ │ ├── monitor-a-zio-application-using-zios-built-in-metric-system.md │ │ ├── produce-consume-data-to-from-kafka-topics.md │ │ ├── run-our-first-zio-project-with-vscode.md │ │ └── running-our-first-zio-project-with-intellij-idea.md ├── overview │ ├── basic-concurrency.md │ ├── basic-operations.md │ ├── creating-effects.md │ ├── handling-errors.md │ ├── handling-resources.md │ ├── index.md │ ├── performance.md │ ├── platforms.md │ ├── running-effects.md │ └── summary.md ├── reference │ ├── architecture │ │ ├── architectural-patterns.md │ │ ├── functional-design-patterns.md │ │ ├── non-functional-requirements.md │ │ └── programming-paradigm.md │ ├── concurrency │ │ ├── hub.md │ │ ├── index.md │ │ ├── promise.md │ │ ├── queue.md │ │ ├── ref.md │ │ ├── refsynchronized.md │ │ └── semaphore.md │ ├── configuration │ │ └── index.md │ ├── contextual │ │ ├── automatic-zlayer-derivation.md │ │ ├── index.md │ │ ├── layer.md │ │ ├── rlayer.md │ │ ├── task-layer.md │ │ ├── ulayer.md │ │ ├── urlayer.md │ │ ├── zenvironment.md │ │ ├── zio-environment-use-cases.md │ │ └── zlayer.md │ ├── control-flow │ │ └── index.md │ ├── core │ │ ├── cause.md │ │ ├── exit.md │ │ ├── index.md │ │ ├── runtime.md │ │ ├── zio │ │ │ ├── io.md │ │ │ ├── rio.md │ │ │ ├── task.md │ │ │ ├── uio.md │ │ │ ├── urio.md │ │ │ └── zio.md │ │ └── zioapp.md │ ├── di │ │ ├── automatic-layer-construction.md │ │ ├── building-dependency-graph.md │ │ ├── dependency-injection-in-zio.md │ │ ├── dependency-memoization.md │ │ ├── dependency-propagation.md │ │ ├── examples.md │ │ ├── index.md │ │ ├── manual-layer-construction.md │ │ ├── motivation.md │ │ ├── overriding-dependency-graph.md │ │ ├── providing-different-implementation-of-a-service.md │ │ └── zlayer-constructor-as-a-value.md │ ├── error-management │ │ ├── best-practices │ │ │ ├── algebraic-data-types.md │ │ │ ├── dont-type-unexpected-errors.md │ │ │ ├── logging-errors.md │ │ │ └── union-types.md │ │ ├── declarative.md │ │ ├── error-accumulation.md │ │ ├── examples.md │ │ ├── exceptional-and-unexceptional-effects.md │ │ ├── expected-and-unexpected-errors.md │ │ ├── index.md │ │ ├── operations │ │ │ ├── chaining-effects-based-on-errors.md │ │ │ ├── converting-defects-to-failures.md │ │ │ ├── error-refinement.md │ │ │ ├── exposing-errors-in-the-success-channel.md │ │ │ ├── exposing-the-cause-in-the-succcess-channel.md │ │ │ ├── filtering-the-success-channel.md │ │ │ ├── flattening-optional-error-types.md │ │ │ ├── flipping-the-error-and-success-channel.md │ │ │ ├── map-operations.md │ │ │ ├── merging-the-error-channel-into-the-success-channel.md │ │ │ ├── rejecting-some-success-values.md │ │ │ ├── tapping-errors.md │ │ │ └── zooming-in-on-nested-values.md │ │ ├── recovering │ │ │ ├── catching.md │ │ │ ├── fallback.md │ │ │ ├── folding.md │ │ │ ├── retrying.md │ │ │ ├── sandboxing.md │ │ │ └── timing-out.md │ │ ├── sequential-and-parallel-errors.md │ │ ├── typed-errors-guarantees.md │ │ └── types │ │ │ ├── defects.md │ │ │ ├── failures.md │ │ │ ├── fatals.md │ │ │ └── index.md │ ├── fiber │ │ ├── fiber.md │ │ ├── fiberid.md │ │ ├── fiberstatus.md │ │ └── index.md │ ├── index.md │ ├── interruption │ │ └── index.md │ ├── observability │ │ ├── logging.md │ │ ├── metrics │ │ │ ├── counter.md │ │ │ ├── frequency.md │ │ │ ├── gauge.md │ │ │ ├── histogram.md │ │ │ ├── index.md │ │ │ ├── jvm.md │ │ │ ├── metriclabel.md │ │ │ └── summary.md │ │ ├── supervisor.md │ │ └── tracing.md │ ├── resource │ │ ├── index.md │ │ ├── scope.md │ │ ├── scopedref.md │ │ ├── zkeyedpool.md │ │ └── zpool.md │ ├── schedule │ │ ├── built-in-schedules.md │ │ ├── combinators.md │ │ ├── examples.md │ │ ├── index.md │ │ ├── repetition.md │ │ └── retrying.md │ ├── service-pattern │ │ ├── accessor-methods.md │ │ ├── defining-polymorphic-services-in-zio.md │ │ ├── index.md │ │ ├── reloadable-services.md │ │ ├── service-pattern.md │ │ └── the-three-laws-of-zio-environment.md │ ├── services │ │ ├── clock.md │ │ ├── console.md │ │ ├── index.md │ │ ├── random.md │ │ └── system.md │ ├── state-management │ │ ├── fiber-local-state.md │ │ ├── fiberref.md │ │ ├── global-shared-state.md │ │ ├── index.md │ │ ├── state-management-using-recursion.md │ │ └── zstate.md │ ├── stm │ │ ├── index.md │ │ ├── stm.md │ │ ├── tarray.md │ │ ├── thub.md │ │ ├── tmap.md │ │ ├── tpriorityqueue.md │ │ ├── tpromise.md │ │ ├── tqueue.md │ │ ├── trandom.md │ │ ├── treentrantlock.md │ │ ├── tref.md │ │ ├── tsemaphore.md │ │ └── tset.md │ ├── stream │ │ ├── chunk.md │ │ ├── index.md │ │ ├── installation.md │ │ ├── subscriptionref.md │ │ ├── zchannel │ │ │ ├── channel-interruption.md │ │ │ ├── channel-operations.md │ │ │ ├── composing-channels.md │ │ │ ├── creating-channels.md │ │ │ ├── index.md │ │ │ └── running-a-channel.md │ │ ├── zpipeline.md │ │ ├── zsink │ │ │ ├── concurrency-and-parallelism.md │ │ │ ├── creating-sinks.md │ │ │ ├── index.md │ │ │ ├── leftovers.md │ │ │ └── operations.md │ │ └── zstream │ │ │ ├── consuming-streams.md │ │ │ ├── creating-zio-streams.md │ │ │ ├── error-handling.md │ │ │ ├── index.md │ │ │ ├── operations.md │ │ │ ├── resourceful-streams.md │ │ │ ├── scheduling.md │ │ │ ├── streams-are-chunked-by-default.md │ │ │ └── type-aliases.md │ ├── sync │ │ ├── concurrentmap.md │ │ ├── concurrentset.md │ │ ├── countdownlatch.md │ │ ├── cyclicbarrier.md │ │ ├── index.md │ │ ├── mvar.md │ │ └── reentrantlock.md │ └── test │ │ ├── aspects │ │ ├── annotating-tests.md │ │ ├── before-after-around.md │ │ ├── conditional-aspects.md │ │ ├── configuring-tests.md │ │ ├── debugging-and-diagnostics.md │ │ ├── environment-specific-tests.md │ │ ├── execution-strategy.md │ │ ├── flaky-and-non-flaky-tests.md │ │ ├── ignoring-tests.md │ │ ├── index.md │ │ ├── non-deterministic-test-data.md │ │ ├── passing-failed-tests.md │ │ ├── repeat-and-retry.md │ │ ├── restoring-state-of-test-services.md │ │ ├── sized.md │ │ └── timing-out-tests.md │ │ ├── assertions │ │ ├── built-in-assertions.md │ │ ├── classic-assertions.md │ │ ├── index.md │ │ └── smart-assertions.md │ │ ├── difference.md │ │ ├── dynamic-test-generation.md │ │ ├── index.md │ │ ├── installation.md │ │ ├── junit-integration.md │ │ ├── property-testing │ │ ├── built-in-generators.md │ │ ├── getting-started.md │ │ ├── how-generators-work.md │ │ ├── index.md │ │ ├── operators.md │ │ └── shrinking.md │ │ ├── running-tests.md │ │ ├── services │ │ ├── clock.md │ │ ├── console.md │ │ ├── index.md │ │ ├── live.md │ │ ├── random.md │ │ ├── sized.md │ │ ├── system.md │ │ └── test-config.md │ │ ├── sharing-layers-between-multiple-files.md │ │ ├── sharing-layers-within-the-same-file.md │ │ ├── spec.md │ │ ├── test-hierarchies-and-organization.md │ │ ├── why-zio-test.md │ │ └── writing-our-first-test.md └── resources │ ├── articles.md │ ├── cheatsheets.md │ ├── cookbooks.md │ ├── index.md │ ├── projectsusingzio.md │ ├── sampleprojects.md │ └── videos.md ├── documentation └── guides │ └── tutorials │ └── make-a-zio-app-configurable │ ├── docs │ └── make-a-zio-application-configurable.md │ └── src │ └── main │ ├── resources │ ├── application.conf │ ├── bigfile.txt │ ├── file.txt │ └── h2-schema.sql │ └── scala │ └── dev │ └── zio │ └── quickstart │ ├── MainApp.scala │ ├── config │ └── HttpServerConfig.scala │ ├── counter │ └── CounterRoutes.scala │ ├── download │ └── DownloadRoutes.scala │ ├── greet │ └── GreetingRoutes.scala │ └── users │ ├── InmemoryUserRepo.scala │ ├── PersistentUserRepo.scala │ ├── User.scala │ ├── UserRepo.scala │ └── UserRoutes.scala ├── examples ├── jvm │ └── src │ │ ├── main │ │ └── scala │ │ │ └── zio │ │ │ └── examples │ │ │ └── metrics │ │ │ ├── JvmMetricAppExample.scala │ │ │ └── MetricAppExample.scala │ │ └── test │ │ └── scala │ │ └── zio │ │ └── examples │ │ └── test │ │ └── ExampleSpecWithJUnit.scala └── shared │ └── src │ ├── main │ ├── scala-2 │ │ └── zio │ │ │ └── examples │ │ │ └── macros │ │ │ └── AccessibleMacroExample.scala │ └── scala │ │ └── zio │ │ └── examples │ │ ├── FromFunctionExample.scala │ │ ├── RealWorldProvideExample.scala │ │ ├── ZLayerInjectExample.scala │ │ └── types │ │ └── OldLady.scala │ └── test │ └── scala │ └── zio │ └── examples │ └── test │ ├── ExampleSpec.scala │ └── ZLayerInjectExampleSpec.scala ├── internal-macros └── src │ └── main │ ├── scala-2 │ └── zio │ │ └── internal │ │ └── macros │ │ └── InternalMacros.scala │ └── scala │ └── zio │ └── internal │ ├── TerminalRendering.scala │ └── ansi.scala ├── macros-tests └── src │ └── test │ ├── scala-2 │ ├── scala │ │ └── annotation │ │ │ └── experimental.scala │ └── zio │ │ └── macros │ │ ├── AccessibleMMSpec.scala │ │ ├── AccessibleMSpec.scala │ │ ├── AccessibleSpec.scala │ │ └── AccessibleSpecFlat.scala │ └── scala │ └── zio │ └── macros │ ├── ReloadableSpec.scala │ └── ServiceReloaderSpec.scala ├── macros └── src │ └── main │ ├── scala-2 │ └── zio │ │ └── macros │ │ ├── AccessibleMMMacro.scala │ │ ├── AccessibleMMacro.scala │ │ ├── AccessibleMMacroBase.scala │ │ ├── AccessibleMacro.scala │ │ ├── AccessibleMacroBase.scala │ │ ├── accessible.scala │ │ ├── accessibleM.scala │ │ ├── accessibleMM.scala │ │ └── throwing.scala │ └── scala │ └── zio │ └── macros │ ├── ServiceReloader.scala │ └── package.scala ├── managed-tests ├── jvm │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── managed │ │ └── ZManagedPlatformSpecificSpec.scala └── shared │ └── src │ └── test │ └── scala │ └── zio │ └── managed │ ├── ZIOBaseSpec.scala │ ├── ZManagedSpec.scala │ └── autowire │ └── AutoWireSpec.scala ├── managed ├── js │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── managed │ │ ├── ZManagedCompatPlatformSpecific.scala │ │ └── ZManagedPlatformSpecific.scala ├── jvm │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── managed │ │ ├── ZManagedCompatPlatformSpecific.scala │ │ └── ZManagedPlatformSpecific.scala ├── native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── managed │ │ ├── ZManagedCompatPlatformSpecific.scala │ │ └── ZManagedPlatformSpecific.scala └── shared │ └── src │ └── main │ ├── scala-2 │ └── zio │ │ └── managed │ │ └── ZManagedVersionSpecific.scala │ ├── scala-3 │ └── zio │ │ └── managed │ │ └── ZManagedVersionSpecific.scala │ └── scala │ └── zio │ └── managed │ ├── ZManaged.scala │ ├── ZManagedAspect.scala │ └── package.scala ├── project ├── BuildHelper.scala ├── Dependencies.scala ├── MimaSettings.scala ├── build.properties └── plugins.sbt ├── renovate.json ├── scalafix ├── input │ └── src │ │ └── main │ │ └── scala │ │ └── fix │ │ ├── AbstractRunnableSpecToZioSpec.scala │ │ ├── BlockingUses.scala │ │ ├── LatchOps.scala │ │ ├── RandomService.scala │ │ ├── ScheduleRenames.scala │ │ ├── Services.scala │ │ ├── ServicesIntermediateMilestone.scala │ │ ├── SimpleApp.scala │ │ ├── ZIOSpec.scala │ │ ├── ZLayerPieces.scala │ │ ├── ZManagedSpec.scala │ │ ├── ZSTMRenames.scala │ │ ├── ZStreamGen.scala │ │ ├── ZStreamPieces.scala │ │ ├── ZStreamSpec.scala │ │ └── Zio2Renames.scala ├── output │ └── src │ │ └── main │ │ └── scala │ │ └── fix │ │ ├── AbstractRunnableSpecToZioSpec.scala │ │ ├── BlockingUses.scala │ │ ├── LatchOps.scala │ │ ├── RandomService.scala │ │ ├── ScheduleRenames.scala │ │ ├── Services.scala │ │ ├── ServicesIntermediateMilestone.scala │ │ ├── SimpleApp.scala │ │ ├── ZIOSpec.scala │ │ ├── ZLayerPieces.scala │ │ ├── ZManagedSpec.scala │ │ ├── ZSTMRenames.scala │ │ ├── ZStreamGen.scala │ │ ├── ZStreamPieces.scala │ │ ├── ZStreamSpec.scala │ │ └── Zio2Renames.scala ├── project │ ├── build.properties │ └── plugins.sbt ├── readme.md ├── rules │ └── src │ │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── scalafix.v1.Rule │ │ └── scala │ │ └── fix │ │ ├── CurriedAssert.scala │ │ └── Zio2Upgrade.scala └── tests │ └── src │ └── test │ └── scala │ └── fix │ └── RuleSuite.scala ├── stacktracer └── src │ └── main │ ├── scala-2 │ └── zio │ │ └── internal │ │ └── stacktracer │ │ ├── Macros.scala │ │ ├── SourceLocation.scala │ │ └── Tracer.scala │ ├── scala-3 │ └── zio │ │ └── internal │ │ └── stacktracer │ │ ├── Macros.scala │ │ ├── SourceLocation.scala │ │ └── Tracer.scala │ └── scala │ └── zio │ ├── internal │ └── stacktracer │ │ ├── ParsedTrace.scala │ │ └── TracerUtils.scala │ └── stacktracer │ └── TracingImplicits.scala ├── streams-tests ├── js │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── stream │ │ └── ZStreamPlatformSpecificSpec.scala ├── jvm-native │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── stream │ │ ├── ZSinkPlatformSpecific2Spec.scala │ │ └── ZStreamPlatformSpecific2Spec.scala ├── jvm │ └── src │ │ └── test │ │ ├── resources │ │ └── zio │ │ │ └── stream │ │ │ ├── bom │ │ │ ├── quickbrown-UTF-16BE-no-BOM.txt │ │ │ ├── quickbrown-UTF-16BE-with-BOM.txt │ │ │ ├── quickbrown-UTF-16LE-no-BOM.txt │ │ │ ├── quickbrown-UTF-16LE-with-BOM.txt │ │ │ ├── quickbrown-UTF-32BE-no-BOM.txt │ │ │ ├── quickbrown-UTF-32BE-with-BOM.txt │ │ │ ├── quickbrown-UTF-32LE-no-BOM.txt │ │ │ ├── quickbrown-UTF-32LE-with-BOM.txt │ │ │ ├── quickbrown-UTF-8-no-BOM.txt │ │ │ ├── quickbrown-UTF-8-with-BOM.txt │ │ │ └── quickbrown-modified-Windows-1252.txt │ │ │ └── compression │ │ │ ├── hello.txt │ │ │ └── hello.txt.gz │ │ └── scala │ │ └── zio │ │ └── stream │ │ ├── DeflateSpec.scala │ │ ├── GunzipSpec.scala │ │ ├── GzipSpec.scala │ │ ├── InflateSpec.scala │ │ ├── RechunkSpec.scala │ │ ├── ZPipelinePlatformSpecificSpec.scala │ │ ├── ZSinkPlatformSpecificSpec.scala │ │ ├── ZStreamPlatformSpecificSpec.scala │ │ └── compression │ │ └── TestData.scala └── shared │ └── src │ └── test │ └── scala │ ├── StreamREPLSpec.scala │ └── zio │ ├── ZIOBaseSpec.scala │ └── stream │ ├── SinkUtils.scala │ ├── StreamLazinessSpec.scala │ ├── SubscriptionRefSpec.scala │ ├── TextCodecPipelineSpec.scala │ ├── ZChannelSimulatedChecks.scala │ ├── ZChannelSpec.scala │ ├── ZPipelineSpec.scala │ ├── ZSinkSpec.scala │ ├── ZStreamGen.scala │ ├── ZStreamParallelErrorsIssuesSpec.scala │ └── ZStreamSpec.scala ├── streams ├── js │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── stream │ │ └── platform.scala ├── jvm │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── stream │ │ └── platform.scala ├── native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── stream │ │ └── platform.scala └── shared │ └── src │ └── main │ ├── scala-2 │ └── zio.stream │ │ └── ZStreamVersionSpecific.scala │ ├── scala-3 │ └── zio.stream │ │ └── ZStreamVersionSpecific.scala │ └── scala │ └── zio │ └── stream │ ├── Deflate.scala │ ├── Gunzip.scala │ ├── Gzip.scala │ ├── Inflate.scala │ ├── SubscriptionRef.scala │ ├── Take.scala │ ├── ZChannel.scala │ ├── ZPipeline.scala │ ├── ZSink.scala │ ├── ZStream.scala │ ├── ZStreamAspect.scala │ ├── compression │ ├── CompressionException.scala │ ├── CompressionParameters.scala │ ├── Deflate.scala │ ├── Gunzipper.scala │ └── Gzipper.scala │ ├── encoding │ └── EncodingException.scala │ ├── internal │ ├── ChannelExecutor.scala │ ├── CharacterSet.scala │ ├── ZInputStream.scala │ └── ZReader.scala │ └── package.scala ├── test-junit-engine-tests ├── maven │ ├── pom.xml │ ├── settings.xml │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── test │ │ └── junit │ │ └── maven │ │ ├── DefectSpec.scala │ │ ├── FailingSpec.scala │ │ └── TaggedSpec.scala └── src │ └── test │ └── scala │ └── zio │ └── test │ └── junit │ └── MavenJunitSpec.scala ├── test-junit-engine └── src │ └── main │ ├── resources │ └── META-INF │ │ └── services │ │ └── org.junit.platform.engine.TestEngine │ └── scala │ └── zio │ └── test │ └── junit │ ├── ReflectionUtils.scala │ ├── TestFailed.scala │ ├── ZIOSuiteTestDescriptor.scala │ ├── ZIOTestClassDescriptor.scala │ ├── ZIOTestClassRunner.scala │ ├── ZIOTestClassSelectorResolver.scala │ ├── ZIOTestDescriptor.scala │ ├── ZIOTestEngine.scala │ └── ZIOTestSource.scala ├── test-junit-tests ├── maven │ ├── pom.xml │ ├── settings.xml │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── test │ │ └── junit │ │ └── maven │ │ ├── DefectSpec.scala │ │ └── FailingSpec.scala └── src │ └── test │ └── scala │ └── zio │ └── test │ └── junit │ └── MavenJunitSpec.scala ├── test-junit └── src │ └── main │ └── scala │ └── zio │ └── test │ └── junit │ └── ZTestJUnitRunner.scala ├── test-magnolia-tests └── src │ └── test │ ├── scala-3 │ └── zio │ │ └── test │ │ └── magnolia │ │ └── DeriveGenSpec_3.scala │ └── scala │ └── zio │ └── test │ └── magnolia │ ├── DeriveDiffSpec.scala │ └── DeriveGenSpec.scala ├── test-magnolia └── src │ └── main │ ├── scala-2 │ └── zio │ │ └── test │ │ └── magnolia │ │ ├── DeriveDiff.scala │ │ └── DeriveGen.scala │ ├── scala-3 │ └── zio │ │ └── test │ │ └── magnolia │ │ ├── DeriveDiff.scala │ │ ├── DeriveGen.scala │ │ └── TypeUnionDerivation.scala │ └── scala │ └── .gitkeep ├── test-refined └── src │ └── main │ └── scala │ └── zio │ └── test │ └── refined │ ├── BooleanInstances.scala │ ├── CharInstances.scala │ ├── CollectionInstances.scala │ ├── GenericInstances.scala │ ├── NumericInstances.scala │ ├── StringInstances.scala │ ├── all.scala │ └── types │ ├── CharInstances.scala │ ├── DigitInstances.scala │ ├── NetInstances.scala │ ├── NumericInstances.scala │ ├── StringInstance.scala │ ├── TimeInstances.scala │ └── all.scala ├── test-sbt ├── js │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── test │ │ └── sbt │ │ ├── SummaryProtocol.scala │ │ ├── ZTestFramework.scala │ │ └── ZTestRunnerJS.scala ├── jvm │ └── src │ │ ├── main │ │ └── scala │ │ │ └── zio │ │ │ └── test │ │ │ └── sbt │ │ │ ├── ZTestFramework.scala │ │ │ └── ZTestRunnerJVM.scala │ │ └── test │ │ └── scala │ │ └── zio │ │ └── test │ │ └── sbt │ │ ├── FrameworkSpecInstances.scala │ │ ├── MockLogger.scala │ │ ├── TestMain.scala │ │ ├── TestingSupport.scala │ │ ├── ZTestEventSpec.scala │ │ ├── ZTestFrameworkSbtSpec.scala │ │ └── ZTestFrameworkZioSpec.scala ├── native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── test │ │ └── sbt │ │ ├── SummaryProtocol.scala │ │ ├── ZTestFramework.scala │ │ └── ZTestRunnerNative.scala └── shared │ └── src │ └── main │ └── scala │ └── zio │ └── test │ └── sbt │ ├── BaseTestTask.scala │ ├── ZTestEvent.scala │ ├── ZTestEventHandlerSbt.scala │ ├── ZioSpecFingerprint.scala │ └── package.scala ├── test-scalacheck └── src │ ├── main │ └── scala │ │ └── zio │ │ └── test │ │ └── scalacheck │ │ └── package.scala │ └── test │ └── scala │ └── zio │ └── test │ └── scalacheck │ └── AssertionSpec.scala ├── test-tests ├── jvm-native │ └── src │ │ └── test │ │ └── scala │ │ └── zio │ │ └── test │ │ ├── environment │ │ └── TestClockSpecJVM.scala │ │ └── results │ │ └── ResultFileOpsJsonSpec.scala └── shared │ └── src │ └── test │ ├── scala-3 │ └── zio │ │ └── test │ │ ├── SmartAssertionScala3Spec.scala │ │ └── TestProvideAutoSpec.scala │ └── scala │ └── zio │ └── test │ ├── AnnotationsSpec.scala │ ├── AssertionRendererSpec.scala │ ├── AssertionSpec.scala │ ├── CheckSpec.scala │ ├── ClockSpec.scala │ ├── CompileSpec.scala │ ├── ConsoleSpec.scala │ ├── ConsoleTestOutputSpec.scala │ ├── EnvironmentSpec.scala │ ├── ExecutionEventSinkSpec.scala │ ├── FunSpec.scala │ ├── GenSpec.scala │ ├── GenUtils.scala │ ├── GenZIOSpec.scala │ ├── IntellijRendererSpec.scala │ ├── LiveSpec.scala │ ├── MyersDiffSpec.scala │ ├── ParallelSuitesInterleavedResultsSpec.scala │ ├── PrettyPrintSpec.scala │ ├── RandomSpec.scala │ ├── ReportingTestUtils.scala │ ├── SampleSpec.scala │ ├── ScopedSpec.scala │ ├── ShowExpressionSpec.scala │ ├── SmartAssertionSpec.scala │ ├── SmartTestTypes.scala │ ├── SpecSpec.scala │ ├── StringDiffingSpec.scala │ ├── SuiteAllSpec.scala │ ├── SummaryBuilderSpec.scala │ ├── SystemSpec.scala │ ├── TestAnnotationMapSpec.scala │ ├── TestArrowSpec.scala │ ├── TestAspectSpec.scala │ ├── TestOutputSpec.scala │ ├── TestProvideSpec.scala │ ├── TestProvideSpecTypes.scala │ ├── TestSpec.scala │ ├── TestUtils.scala │ ├── ZIOBaseSpec.scala │ ├── ZIOSpecAbstractSpec.scala │ ├── laws │ ├── Laws2Spec.scala │ ├── LawsFSpec.scala │ └── LawsSpec.scala │ ├── poly │ └── PolySpec.scala │ └── results │ └── ResultSerializerSpec.scala ├── test ├── js │ └── src │ │ └── main │ │ ├── scala-2.12 │ │ └── zio │ │ │ └── test │ │ │ └── FieldExtractorPlatformSpecific.scala │ │ └── scala │ │ └── zio │ │ └── test │ │ ├── TestClockPlatformSpecific.scala │ │ ├── TestDebug.scala │ │ ├── TestPlatform.scala │ │ └── results │ │ ├── ResultFileOpsJson.scala │ │ └── ResultPrinterJson.scala ├── jvm-native │ └── src │ │ └── main │ │ └── scala │ │ └── zio │ │ └── test │ │ ├── TestClockPlatformSpecific.scala │ │ ├── TestDebug.scala │ │ └── results │ │ ├── ResultFileOps.scala │ │ └── ResultPrinterJson.scala ├── jvm │ └── src │ │ └── main │ │ ├── scala-2.12 │ │ └── zio │ │ │ └── test │ │ │ └── FieldExtractorPlatformSpecific.scala │ │ └── scala │ │ └── zio │ │ └── test │ │ └── TestPlatform.scala ├── native │ └── src │ │ └── main │ │ ├── scala-2.12 │ │ └── zio │ │ │ └── test │ │ │ └── FieldExtractorPlatformSpecific.scala │ │ └── scala │ │ └── zio │ │ └── test │ │ └── TestPlatform.scala └── shared │ └── src │ └── main │ ├── scala-2.12 │ └── zio │ │ └── test │ │ ├── AssertionVariants.scala │ │ ├── PrettyPrintVersionSpecific.scala │ │ └── TestVersion.scala │ ├── scala-2.13+ │ └── zio │ │ └── test │ │ └── PrettyPrintVersionSpecific.scala │ ├── scala-2.13 │ └── zio │ │ └── test │ │ ├── AssertionVariants.scala │ │ └── TestVersion.scala │ ├── scala-2 │ └── zio │ │ └── test │ │ ├── CompileVariants.scala │ │ ├── Eql.scala │ │ ├── Macros.scala │ │ ├── SmartAssertMacros.scala │ │ ├── SmartSpecMacros.scala │ │ ├── SpecLayerMacros.scala │ │ ├── SpecVersionSpecific.scala │ │ ├── ZIOSpecAbstractVersionSpecific.scala │ │ ├── ZIOSpecVersionSpecific.scala │ │ └── diff │ │ └── Diff.scala │ ├── scala-3 │ └── zio │ │ └── test │ │ ├── AssertionVariants.scala │ │ ├── CompileVariants.scala │ │ ├── Macros.scala │ │ ├── SpecLayerMacros.scala │ │ ├── SpecVersionSpecific.scala │ │ ├── TestVersion.scala │ │ ├── ZIOSpecAbstractVersionSpecific.scala │ │ ├── ZIOSpecVersionSpecific.scala │ │ └── diff │ │ └── Diff.scala │ └── scala │ └── zio │ └── test │ ├── Annotations.scala │ ├── Assertion.scala │ ├── CheckConstructor.scala │ ├── ConcurrentHashMap.scala │ ├── ConsoleIO.scala │ ├── ErrorMessage.scala │ ├── ExecutionEvent.scala │ ├── ExecutionEventConsolePrinter.scala │ ├── ExecutionEventPrinter.scala │ ├── ExecutionEventSink.scala │ ├── FilteredSpec.scala │ ├── Fun.scala │ ├── FunctionVariants.scala │ ├── Gen.scala │ ├── GenFailureDetails.scala │ ├── GenZIO.scala │ ├── Live.scala │ ├── PrettyPrint.scala │ ├── RenderUtils.scala │ ├── ReporterEventRenderer.scala │ ├── Restorable.scala │ ├── Result.scala │ ├── Sample.scala │ ├── Sized.scala │ ├── Spec.scala │ ├── SuiteConstructor.scala │ ├── SuiteId.scala │ ├── Summary.scala │ ├── SummaryBuilder.scala │ ├── TestAnnotation.scala │ ├── TestAnnotationMap.scala │ ├── TestAnnotationRenderer.scala │ ├── TestArgs.scala │ ├── TestArrow.scala │ ├── TestAspect.scala │ ├── TestClock.scala │ ├── TestConfig.scala │ ├── TestConsole.scala │ ├── TestConstructor.scala │ ├── TestDebugFileLock.scala │ ├── TestDuration.scala │ ├── TestExecutor.scala │ ├── TestFailure.scala │ ├── TestLens.scala │ ├── TestLogger.scala │ ├── TestOutput.scala │ ├── TestRandom.scala │ ├── TestReporters.scala │ ├── TestRunner.scala │ ├── TestServices.scala │ ├── TestSuccess.scala │ ├── TestSystem.scala │ ├── TestTimeoutException.scala │ ├── TestTrace.scala │ ├── TimeVariants.scala │ ├── TimeoutVariants.scala │ ├── ZIOSpec.scala │ ├── ZIOSpecAbstract.scala │ ├── ZIOSpecDefault.scala │ ├── ZTestEventHandler.scala │ ├── ZTestLogger.scala │ ├── diff │ ├── DiffInstances.scala │ └── DiffResult.scala │ ├── internal │ ├── OptionalImplicit.scala │ ├── SmartAssertions.scala │ └── myers │ │ └── MyersDiff.scala │ ├── laws │ ├── GenF.scala │ ├── GenF2.scala │ ├── ZLawful.scala │ ├── ZLawful2.scala │ ├── ZLawfulF.scala │ ├── ZLawfulF2.scala │ ├── ZLaws.scala │ ├── ZLaws2.scala │ ├── ZLawsF.scala │ ├── ZLawsF2.scala │ └── package.scala │ ├── package.scala │ ├── poly │ ├── GenFractionalPoly.scala │ ├── GenIntegralPoly.scala │ ├── GenNumericPoly.scala │ ├── GenOrderingPoly.scala │ └── GenPoly.scala │ ├── render │ ├── ConsoleRenderer.scala │ ├── ExecutionResult.scala │ ├── IntelliJRenderer.scala │ ├── LogLine.scala │ ├── TestRenderer.scala │ └── package.scala │ └── results │ ├── ResultSerializer.scala │ └── TestResultPrinter.scala ├── website ├── .prettierrc ├── .yarnrc ├── README.md ├── babel.config.js ├── blog │ ├── 2023-03-23-welcome-to-the-zio-blog.md │ └── 2023-10-09-zio-chat-announcement.md ├── core │ └── Footer.js ├── docusaurus.config.js ├── package.json ├── patch-guides.sh ├── plugins │ ├── google-fonts │ │ └── index.js │ └── zio-ecosystem-docusaurus │ │ ├── index.js │ │ ├── index.ts │ │ └── tsconfig.json ├── postcss.config.js ├── sidebars.js ├── src │ ├── components │ │ ├── EmbeddedVideo │ │ │ ├── Poster │ │ │ │ ├── index.jsx │ │ │ │ └── styles.module.css │ │ │ ├── Video │ │ │ │ ├── index.jsx │ │ │ │ └── styles.module.css │ │ │ └── index.jsx │ │ ├── sections │ │ │ ├── Ecosystem │ │ │ │ ├── data.js │ │ │ │ ├── index.jsx │ │ │ │ └── styles.module.css │ │ │ ├── Features │ │ │ │ ├── data.js │ │ │ │ └── index.jsx │ │ │ ├── Hero │ │ │ │ └── index.jsx │ │ │ ├── Sponsors │ │ │ │ ├── data.js │ │ │ │ └── index.jsx │ │ │ └── Zionomicon │ │ │ │ ├── index.js │ │ │ │ └── styles.module.css │ │ └── ui │ │ │ └── SectionWrapper │ │ │ ├── index.jsx │ │ │ └── styles.module.css │ ├── css │ │ └── custom.css │ ├── pages │ │ ├── en │ │ │ ├── help.js.org │ │ │ ├── index.js.org │ │ │ └── users.js.org │ │ ├── index.jsx │ │ └── version2-only-index.js.txt │ └── theme │ │ ├── DocVersionBanner │ │ └── index.js │ │ └── Footer │ │ └── index.js ├── static │ ├── .nojekyll │ ├── css │ │ └── prism │ │ │ ├── LICENSE │ │ │ ├── prism-a11y-dark.css │ │ │ ├── prism-atom-dark.css │ │ │ ├── prism-base16-ateliersulphurpool.light.css │ │ │ ├── prism-cb.css │ │ │ ├── prism-coldark-cold.css │ │ │ ├── prism-coldark-dark.css │ │ │ ├── prism-coy-without-shadows.css │ │ │ ├── prism-darcula.css │ │ │ ├── prism-dracula.css │ │ │ ├── prism-duotone-dark.css │ │ │ ├── prism-duotone-earth.css │ │ │ ├── prism-duotone-forest.css │ │ │ ├── prism-duotone-light.css │ │ │ ├── prism-duotone-sea.css │ │ │ ├── prism-duotone-space.css │ │ │ ├── prism-ghcolors.css │ │ │ ├── prism-gruvbox-dark.css │ │ │ ├── prism-gruvbox-light.css │ │ │ ├── prism-holi-theme.css │ │ │ ├── prism-hopscotch.css │ │ │ ├── prism-lucario.css │ │ │ ├── prism-material-dark.css │ │ │ ├── prism-material-light.css │ │ │ ├── prism-material-oceanic.css │ │ │ ├── prism-night-owl.css │ │ │ ├── prism-nord.css │ │ │ ├── prism-one-dark.css │ │ │ ├── prism-pojoaque.css │ │ │ ├── prism-shades-of-purple.css │ │ │ ├── prism-solarized-dark-atom.css │ │ │ ├── prism-synthwave84.css │ │ │ ├── prism-vs.css │ │ │ ├── prism-vsc-dark-plus.css │ │ │ ├── prism-xonokai.css │ │ │ └── prism-z-touch.css │ └── img │ │ ├── assets │ │ ├── comparing-changes.png │ │ ├── edit-this-page.png │ │ ├── github-editor.png │ │ ├── hub.png │ │ ├── hub.svg │ │ ├── open-a-pull-request.png │ │ ├── propose-changes.png │ │ ├── zio-streams-1.x.png │ │ ├── zio-streams-1.x.svg │ │ ├── zio-streams-2.x.png │ │ ├── zio-streams-2.x.svg │ │ ├── zio-streams-zchannel.png │ │ └── zio-streams-zchannel.svg │ │ ├── discord.png │ │ ├── favicon.png │ │ ├── jumbotron_pattern.png │ │ ├── navbar_brand.png │ │ ├── navbar_brand2x.png │ │ ├── septimal_mind.svg │ │ ├── sidebar_brand.png │ │ ├── sidebar_brand2x.png │ │ ├── softwaremill.svg │ │ ├── users │ │ ├── adgear.png │ │ ├── adidas.svg │ │ ├── adpulse.svg │ │ ├── adsquare.svg │ │ ├── asana.svg │ │ ├── audela.png │ │ ├── aurinko.svg │ │ ├── auto.svg │ │ ├── autoscout24.svg │ │ ├── avast.svg │ │ ├── ayolab-black.png │ │ ├── ayolab-white.png │ │ ├── bofa.svg │ │ ├── calcbank.png │ │ ├── callhandling.png │ │ ├── carvana.png │ │ ├── cellular.svg │ │ ├── cloudfarms.png │ │ ├── codecomprehension.svg │ │ ├── codept.svg │ │ ├── colisweb.png │ │ ├── collibra.svg │ │ ├── compellon.png │ │ ├── conduktor.svg │ │ ├── coralogix.svg │ │ ├── creditkarma.svg │ │ ├── currencycloud.svg │ │ ├── datachef.png │ │ ├── de-solution.png │ │ ├── demandbase.svg │ │ ├── demyst.png │ │ ├── demyst.svg │ │ ├── devsisters.png │ │ ├── doomoolmori.png │ │ ├── dow-jones.png │ │ ├── dow-jones.svg │ │ ├── dpg-recruitment.jpeg │ │ ├── dpg.jpeg │ │ ├── eaglescience.png │ │ ├── eaglescience2.png │ │ ├── ebay.svg │ │ ├── edf.svg │ │ ├── enel-x.svg │ │ ├── evo.png │ │ ├── evo.svg │ │ ├── flipp.png │ │ ├── fugo.png │ │ ├── fugo.svg │ │ ├── gleancompany.png │ │ ├── grandparade.png │ │ ├── hunters.jpg │ │ ├── hunters.svg │ │ ├── iheart.png │ │ ├── investsuite.svg │ │ ├── iot-telekom.svg │ │ ├── kaizen-solutions.svg │ │ ├── kamon-logo-dark.svg │ │ ├── kamon-logo-light.svg │ │ ├── kensu.svg │ │ ├── lambdaworks.png │ │ ├── leadiq.svg │ │ ├── liveintent.png │ │ ├── liveintent.svg │ │ ├── logo-references.md │ │ ├── matechs.svg │ │ ├── megogo.png │ │ ├── mylivn.png │ │ ├── newmotion.svg │ │ ├── nexxchange.svg │ │ ├── nslookup.svg │ │ ├── ocadogroup.png │ │ ├── olyro.svg │ │ ├── optrak.jpg │ │ ├── performance-immo.png │ │ ├── pimsolutions.svg │ │ ├── playtika.png │ │ ├── ppcsamurai.jpg │ │ ├── ppcsamurai.svg │ │ ├── rewe-digital.svg │ │ ├── riskident.svg │ │ ├── rocker.svg │ │ ├── rudder.png │ │ ├── sanjagh.png │ │ ├── scalac.svg │ │ ├── securityscorecard.png │ │ ├── sentinelone.svg │ │ ├── signicat.png │ │ ├── softwaremill.svg │ │ ├── streamweaver.png │ │ ├── stuart.png │ │ ├── teads.svg │ │ ├── tinka.svg │ │ ├── tinkoff.png │ │ ├── tomtom.png │ │ ├── tranzzo.svg │ │ ├── tweddle.png │ │ ├── tweddle.svg │ │ ├── unit.svg │ │ ├── univalence.png │ │ ├── vakantiediscounter.svg │ │ ├── valamis.png │ │ ├── verbund.svg │ │ ├── virtuslab.svg │ │ ├── vish.png │ │ ├── vish.svg │ │ ├── vivid.png │ │ ├── wehkamp.png │ │ ├── werkenbijdhl.png │ │ ├── werkenbijrandstad.svg │ │ ├── wolt.png │ │ ├── zalando.svg │ │ └── zooz.svg │ │ ├── yourkit.png │ │ ├── zio-CMYK │ │ ├── zio-full-color-cmyk-01.jpg │ │ ├── zio-full-color-cmyk-01.png │ │ ├── zio-full-color-cmyk-01.psd │ │ ├── zio-full-color-cmyk.ai │ │ ├── zio-full-color-cmyk.eps │ │ └── zio-full-color-cmyk.pdf │ │ ├── zio-RGB │ │ ├── zio full color RGB │ │ │ ├── zio-full-color-rgb.ai │ │ │ ├── zio-full-color-rgb.eps │ │ │ ├── zio-full-color-rgb.jpg │ │ │ ├── zio-full-color-rgb.pdf │ │ │ ├── zio-full-color-rgb.png │ │ │ └── zio-full-color-rgb.psd │ │ └── zio-monochromes-rgb │ │ │ ├── black-rgb │ │ │ ├── zio-black-invert-rgb-01.jpg │ │ │ ├── zio-black-rgb-01.png │ │ │ ├── zio-black-rgb.ai │ │ │ ├── zio-black-rgb.eps │ │ │ └── zio-black-rgb.pdf │ │ │ ├── red-rgb │ │ │ ├── zio-red-invert-rgb-01.jpg │ │ │ ├── zio-red-rgb-01.png │ │ │ ├── zio-red-rgb.ai │ │ │ ├── zio-red-rgb.eps │ │ │ └── zio-red-rgb.pdf │ │ │ └── white-rgb │ │ │ ├── zio-white-invert-rgb-01.jpg │ │ │ ├── zio-white-rgb-01.png │ │ │ ├── zio-white-rgb.ai │ │ │ ├── zio-white-rgb.eps │ │ │ └── zio-white-rgb.pdf │ │ ├── zio-github │ │ ├── zio-github-01.png │ │ ├── zio-github.ai │ │ ├── zio-github.eps │ │ └── zio-github.pdf │ │ ├── zio-runtime-system.png │ │ ├── zio-runtime-system.svg │ │ ├── zio-splash │ │ ├── zio-splash-01.jpg │ │ ├── zio-splash.ai │ │ ├── zio-splash.eps │ │ ├── zio-splash.pdf │ │ └── zio-splash.psd │ │ ├── zio-twitter │ │ ├── zio-twitter-01.jpg │ │ ├── zio-twitter.ai │ │ ├── zio-twitter.eps │ │ └── zio-twitter.pdf │ │ ├── zio.png │ │ ├── zionomicon.png │ │ └── ziverge.png ├── tailwind.config.js ├── upgrade-zio-docs.sh ├── versioned_docs │ └── version-1.0.18 │ │ ├── about │ │ ├── code_of_conduct.md │ │ ├── coding_guidelines.md │ │ ├── contributing.md │ │ └── index.md │ │ ├── canfail.md │ │ ├── getting_started.md │ │ ├── guides │ │ ├── access-system-information.md │ │ ├── handle-errors.md │ │ ├── howto-macros.md │ │ ├── index.md │ │ ├── interop │ │ │ ├── with-cats-effect.md │ │ │ ├── with-future.md │ │ │ ├── with-guava.md │ │ │ ├── with-java.md │ │ │ ├── with-javascript.md │ │ │ ├── with-monix.md │ │ │ ├── with-reactive-streams.md │ │ │ ├── with-scalaz-7x.md │ │ │ └── with-twitter.md │ │ ├── migrate │ │ │ ├── from-cats-efect.md │ │ │ └── from-monix.md │ │ ├── mock-services.md │ │ ├── test_effects.md │ │ └── use-test-assertions.md │ │ ├── overview │ │ ├── background.md │ │ ├── basic_concurrency.md │ │ ├── basic_operations.md │ │ ├── creating_effects.md │ │ ├── handling_errors.md │ │ ├── handling_resources.md │ │ ├── index.md │ │ ├── performance.md │ │ ├── platforms.md │ │ ├── running_effects.md │ │ └── testing_effects.md │ │ ├── reference │ │ ├── concurrency │ │ │ ├── hub.md │ │ │ ├── index.md │ │ │ ├── promise.md │ │ │ ├── queue.md │ │ │ ├── ref.md │ │ │ ├── refm.md │ │ │ ├── semaphore.md │ │ │ ├── zref.md │ │ │ └── zrefm.md │ │ ├── contextual │ │ │ ├── has.md │ │ │ ├── index.md │ │ │ ├── layer.md │ │ │ ├── rlayer.md │ │ │ ├── task-layer.md │ │ │ ├── ulayer.md │ │ │ ├── urlayer.md │ │ │ └── zlayer.md │ │ ├── core │ │ │ ├── cause.md │ │ │ ├── exit.md │ │ │ ├── index.md │ │ │ ├── io.md │ │ │ ├── rio.md │ │ │ ├── runtime.md │ │ │ ├── task.md │ │ │ ├── uio.md │ │ │ ├── urio.md │ │ │ └── zio.md │ │ ├── fiber │ │ │ ├── fiber.md │ │ │ ├── fiberid.md │ │ │ ├── fiberref.md │ │ │ ├── fiberstatus.md │ │ │ └── index.md │ │ ├── index.md │ │ ├── misc │ │ │ ├── chunk.md │ │ │ ├── index.md │ │ │ ├── schedule.md │ │ │ └── supervisor.md │ │ ├── resource │ │ │ ├── index.md │ │ │ ├── managed.md │ │ │ ├── rmanaged.md │ │ │ ├── task-managed.md │ │ │ ├── umanaged.md │ │ │ ├── urmanaged.md │ │ │ └── zmanaged.md │ │ ├── services │ │ │ ├── blocking.md │ │ │ ├── clock.md │ │ │ ├── console.md │ │ │ ├── index.md │ │ │ ├── random.md │ │ │ └── system.md │ │ ├── stm │ │ │ ├── index.md │ │ │ ├── stm.md │ │ │ ├── tarray.md │ │ │ ├── tmap.md │ │ │ ├── tpriorityqueue.md │ │ │ ├── tpromise.md │ │ │ ├── tqueue.md │ │ │ ├── treentrantlock.md │ │ │ ├── tref.md │ │ │ ├── tsemaphore.md │ │ │ └── tset.md │ │ ├── stream │ │ │ ├── index.md │ │ │ ├── sink.md │ │ │ ├── stream.md │ │ │ ├── subscriptionref.md │ │ │ ├── transducer.md │ │ │ ├── ustream.md │ │ │ ├── zsink.md │ │ │ ├── zstream.md │ │ │ └── ztransducer.md │ │ └── sync │ │ │ ├── concurrentmap.md │ │ │ ├── concurrentset.md │ │ │ ├── countdownlatch.md │ │ │ └── cyclicbarrier.md │ │ └── resources │ │ ├── ecosystem │ │ ├── community.md │ │ ├── compatible.md │ │ ├── officials.md │ │ ├── templates.md │ │ └── tools.md │ │ ├── index.md │ │ └── learning │ │ ├── articles.md │ │ ├── cheatsheets.md │ │ ├── cookbooks.md │ │ ├── projectsusingzio.md │ │ ├── sampleprojects.md │ │ └── videos.md ├── versioned_sidebars │ └── version-1.0.18-sidebars.json ├── versions.json └── yarn.nix └── zio-docs └── src └── main └── scala └── utils.scala /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Added scalafmt for Scala 3 2 | 3ee6e584f1b9d61391d915dc3f722c318f54fbad 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | template: | 4 | # What's Changed 5 | $CHANGES 6 | categories: 7 | - title: 'Breaking' 8 | label: 'type: breaking' 9 | - title: 'New' 10 | label: 'type: feature' 11 | - title: 'Bug Fixes' 12 | label: 'type: bug' 13 | - title: 'Maintenance' 14 | label: 'type: maintenance' 15 | - title: 'Documentation' 16 | label: 'type: docs' 17 | - title: 'Dependency Updates' 18 | label: 'type: dependencies' 19 | 20 | version-resolver: 21 | major: 22 | labels: 23 | - 'type: breaking' 24 | minor: 25 | labels: 26 | - 'type: feature' 27 | patch: 28 | labels: 29 | - 'type: bug' 30 | - 'type: maintenance' 31 | - 'type: docs' 32 | - 'type: dependencies' 33 | - 'type: security' 34 | 35 | exclude-labels: 36 | - 'skip-changelog' 37 | -------------------------------------------------------------------------------- /.github/workflows/auto-approve.yml: -------------------------------------------------------------------------------- 1 | name: Auto-approve Renovate's PRs 2 | 3 | on: pull_request_target 4 | 5 | jobs: 6 | auto-approve-renovate-prs: 7 | runs-on: ubuntu-latest 8 | if: github.actor == 'renovate[bot]' 9 | steps: 10 | - name: Git Checkout 11 | uses: actions/checkout@v4.2.2 12 | with: 13 | fetch-depth: 1000 14 | fetch-tags: true 15 | - name: Approve PR 16 | run: gh pr review --approve ${{ github.event.number }} 17 | env: 18 | GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 19 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: 6 | - series/2.x 7 | 8 | jobs: 9 | update_release_draft: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: release-drafter/release-drafter@v6 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | -------------------------------------------------------------------------------- /.github/workflows/scala-steward.yml: -------------------------------------------------------------------------------- 1 | name: Scala Steward 2 | 3 | # This workflow will launch every day at 00:00 4 | on: 5 | schedule: 6 | - cron: '0 0 * * *' 7 | workflow_dispatch: {} 8 | 9 | permissions: 10 | contents: write 11 | pull-requests: write 12 | 13 | jobs: 14 | scala-steward: 15 | timeout-minutes: 45 16 | runs-on: ubuntu-latest 17 | name: Scala Steward 18 | steps: 19 | - name: Setup sbt 20 | uses: sbt/setup-sbt@v1 21 | - name: Scala Steward 22 | uses: scala-steward-org/scala-steward-action@v2 23 | with: 24 | github-app-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_ID }} 25 | github-app-installation-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_INSTALLATION_ID }} 26 | github-app-key: ${{ secrets.SCALA_STEWARD_GITHUB_APP_PRIVATE_KEY }} 27 | github-app-auth-only: true 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | project/zecret 2 | project/travis-deploy-key 3 | project/secrets.tar.xz 4 | target 5 | test-output/ 6 | .sbtopts 7 | .bsp 8 | project/.sbt 9 | test-output/ 10 | .bloop 11 | .metals 12 | metals.sbt 13 | */metals.sbt 14 | .idea 15 | coursier 16 | .DS_Store 17 | metals.sbt 18 | project/metals.sbt 19 | project/project/metals.sbt 20 | sbt.json 21 | .bsp/ 22 | project/project/ 23 | *.iml 24 | 25 | # if you are here to add your IDE's files please read this instead: 26 | # https://stackoverflow.com/questions/7335420/global-git-ignore#22885996 27 | website/node_modules 28 | website/.docusaurus 29 | website/build 30 | website/docs 31 | website/static/api* 32 | website/i18n/en.json 33 | website/yarn.lock 34 | website/package-lock.json 35 | website/static/api 36 | website/yarn-error.log 37 | website/ecosystem-sidebar.js 38 | .bsp/ 39 | .vscode 40 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | RUN curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)" && \ 4 | chmod +x cs && \ 5 | ./cs install cs && \ 6 | echo 'export PATH="$PATH:/home/gitpod/.local/share/coursier/bin"' >> ~/.zshrc && \ 7 | echo 'export PATH="$PATH:/home/gitpod/.local/share/coursier/bin"' >> ~/.bashrc && \ 8 | ./cs install scala sbt scalafix scalafmt ammonite && \ 9 | ./cs install bloop --only-prebuilt=true && \ 10 | rm cs 11 | 12 | RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended 13 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | vscode: 4 | extensions: 5 | - scala-lang.scala 6 | - scalameta.metals 7 | ports: 8 | - port: 8212 9 | onOpen: ignore -------------------------------------------------------------------------------- /.jvmopts: -------------------------------------------------------------------------------- 1 | -Dcats.effect.stackTracingMode=full 2 | -Dfile.encoding=UTF8 3 | -Xms256M 4 | -Xmx6G 5 | -XX:+UseG1GC 6 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 16.13.1 2 | -------------------------------------------------------------------------------- /.scala-steward.conf: -------------------------------------------------------------------------------- 1 | updates.ignore = [ 2 | { groupId = "org.scala-native", artifactId="sbt-scala-native", version = "0.5.7" } 3 | ] 4 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | version = "3.8.2" 2 | maxColumn = 120 3 | align.preset = most 4 | align.multiline = false 5 | continuationIndent.defnSite = 2 6 | assumeStandardLibraryStripMargin = true 7 | docstrings.style = Asterisk 8 | docstrings.wrapMaxColumn = 80 9 | lineEndings = preserve 10 | includeCurlyBraceInSelectChains = false 11 | danglingParentheses.preset = true 12 | optIn.annotationNewlines = true 13 | newlines.alwaysBeforeMultilineDef = false 14 | runner.dialect = scala213 15 | rewrite.rules = [RedundantBraces] 16 | 17 | project.excludePaths = ["glob:**/scalafix/input/**", "glob:**/scalafix/output/**"] 18 | 19 | rewrite.redundantBraces.generalExpressions = false 20 | rewriteTokens = { 21 | "⇒": "=>" 22 | "→": "->" 23 | "←": "<-" 24 | } 25 | 26 | fileOverride { 27 | "glob:**/scala-3/**" { 28 | runner.dialect = scala3 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.ignoreWords": [ 3 | "accum", 4 | "unensures", 5 | "untrack", 6 | "urio" 7 | ], 8 | "files.watcherExclude": { 9 | "**/target": true 10 | } 11 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ./docs/code-of-conduct.md -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ./docs/contributor-guidelines.md -------------------------------------------------------------------------------- /ZIO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/ZIO.png -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/ForkAllBenchmark.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import java.util.concurrent._ 4 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 5 | import zio.BenchmarkUtil._ 6 | 7 | @Measurement(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS) 8 | @Warmup(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS) 9 | @Fork(2) 10 | @Threads(1) 11 | @State(JScope.Thread) 12 | @BenchmarkMode(Array(Mode.Throughput)) 13 | @OutputTimeUnit(TimeUnit.SECONDS) 14 | class ForkAllBenchmark { 15 | 16 | @Param(Array("1", "128", "1024")) 17 | var count: Int = 0 18 | 19 | var z: ZIO[Any, Nothing, Chunk[Unit]] = _ 20 | 21 | @Setup 22 | def setup(): Unit = { 23 | val tasks = 24 | Chunk.fill(count) { 25 | ZIO.succeed(()) 26 | } 27 | z = ZIO.forkAll(tasks).flatMap(_.join) 28 | } 29 | 30 | @Benchmark 31 | def run(): Chunk[Unit] = 32 | unsafeRun(z) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/ForkAllDiscardBenchmark.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import java.util.concurrent._ 4 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 5 | import zio.BenchmarkUtil._ 6 | 7 | @Measurement(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS) 8 | @Warmup(iterations = 10, time = 3, timeUnit = TimeUnit.SECONDS) 9 | @Fork(2) 10 | @Threads(1) 11 | @State(JScope.Thread) 12 | @BenchmarkMode(Array(Mode.Throughput)) 13 | @OutputTimeUnit(TimeUnit.SECONDS) 14 | class ForkAllDiscardBenchmark { 15 | 16 | @Param(Array("1", "128", "1024")) 17 | var count: Int = 0 18 | 19 | var z: ZIO[Any, Nothing, Unit] = _ 20 | 21 | @Setup 22 | def setup(): Unit = { 23 | val tasks = 24 | Chunk.fill(count) { 25 | ZIO.succeed(()) 26 | } 27 | z = ZIO.forkAllDiscard(tasks).flatMap(_.join) 28 | } 29 | 30 | @Benchmark 31 | def run(): Unit = 32 | unsafeRun(z) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/chunks/ChunkFindBenchmarks.scala: -------------------------------------------------------------------------------- 1 | package zio.chunks 2 | 3 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 4 | import zio._ 5 | 6 | import java.util.concurrent.TimeUnit 7 | 8 | @State(JScope.Thread) 9 | @BenchmarkMode(Array(Mode.AverageTime)) 10 | @OutputTimeUnit(TimeUnit.NANOSECONDS) 11 | @Warmup(iterations = 10, time = 10) 12 | @Measurement(iterations = 10, time = 10) 13 | class ChunkFindBenchmarks { 14 | @Param(Array("1000")) 15 | var size: Int = _ 16 | 17 | var chunk: Chunk[Int] = _ 18 | var vector: Vector[Int] = _ 19 | var list: List[Int] = _ 20 | 21 | @Setup(Level.Trial) 22 | def setup(): Unit = { 23 | val array = (1 to size).toArray 24 | chunk = Chunk.fromArray(array) 25 | vector = array.toVector 26 | list = array.toList 27 | } 28 | 29 | @Benchmark 30 | def find(): Option[Int] = chunk.find(_ > 2) 31 | } 32 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/chunks/ChunkFlatMapBenchmarks.scala: -------------------------------------------------------------------------------- 1 | package zio.chunks 2 | 3 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 4 | import zio._ 5 | 6 | import java.util.concurrent.TimeUnit 7 | 8 | @State(JScope.Thread) 9 | @BenchmarkMode(Array(Mode.AverageTime)) 10 | @OutputTimeUnit(TimeUnit.NANOSECONDS) 11 | @Warmup(iterations = 10, time = 10) 12 | @Measurement(iterations = 10, time = 10) 13 | class ChunkFlatMapBenchmarks { 14 | @Param(Array("1000")) 15 | var size: Int = _ 16 | 17 | var chunk: Chunk[Int] = _ 18 | var vector: Vector[Int] = _ 19 | var list: List[Int] = _ 20 | 21 | @Setup(Level.Trial) 22 | def setup(): Unit = { 23 | val array = (1 to size).toArray 24 | chunk = Chunk.fromArray(array) 25 | vector = array.toVector 26 | list = array.toList 27 | } 28 | 29 | @Benchmark 30 | def flatMap(): Chunk[Int] = chunk.flatMap(n => Chunk(n + 2)) 31 | } 32 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/internal/JucBlockingQueue.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import java.util.concurrent.LinkedBlockingQueue 4 | 5 | class JucBlockingQueue[A] extends MutableConcurrentQueue[A] { 6 | override val capacity: Int = Int.MaxValue 7 | 8 | private val jucBlockingQueue = new LinkedBlockingQueue[A](capacity) 9 | 10 | override def size(): Int = jucBlockingQueue.size() 11 | 12 | override def enqueuedCount(): Long = throw new UnsupportedOperationException("enqueuedCount not implemented") 13 | 14 | override def dequeuedCount(): Long = throw new UnsupportedOperationException("dequeuedCount not implemented") 15 | 16 | override def offer(a: A): Boolean = jucBlockingQueue.offer(a) 17 | 18 | override def poll(default: A): A = { 19 | val res = jucBlockingQueue.poll() 20 | if (res != null) res else default 21 | } 22 | 23 | override def isEmpty(): Boolean = jucBlockingQueue.isEmpty 24 | 25 | override def isFull(): Boolean = false 26 | } 27 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/internal/MergeAllParBenchmark.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 4 | import zio.BenchmarkUtil._ 5 | import zio.ZIO.succeed 6 | import zio._ 7 | 8 | import java.util.concurrent.TimeUnit 9 | 10 | @State(JScope.Thread) 11 | @BenchmarkMode(Array(Mode.Throughput)) 12 | @OutputTimeUnit(TimeUnit.SECONDS) 13 | @Fork(value = 1) 14 | private[this] class MergeAllParBenchmark { 15 | 16 | private val in = List.fill(10000)(ZIO.unit) 17 | 18 | @Benchmark 19 | def mergeAllPar(): Unit = 20 | unsafeRun(ZIO.mergeAllPar(in)(())((_, _) => ())) 21 | 22 | @Benchmark 23 | def naiveMergeAllPar(): Unit = 24 | unsafeRun(naiveMergeAllPar(in)(())((_, _) => ())) 25 | 26 | private def naiveMergeAllPar[R, E, A, B]( 27 | in: Iterable[ZIO[R, E, A]] 28 | )(zero: B)(f: (B, A) => B): ZIO[R, E, B] = 29 | in.foldLeft[ZIO[R, E, B]](succeed[B](zero))((acc, a) => acc.zipPar(a).map(f.tupled)) 30 | } 31 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/internal/ReduceAllParBenchmark.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 4 | import zio.BenchmarkUtil._ 5 | import zio._ 6 | 7 | import java.util.concurrent.TimeUnit 8 | 9 | @State(JScope.Thread) 10 | @BenchmarkMode(Array(Mode.Throughput)) 11 | @OutputTimeUnit(TimeUnit.SECONDS) 12 | @Fork(value = 1) 13 | private[this] class ReduceAllParBenchmark { 14 | 15 | private val a = ZIO.unit 16 | private val as = List.fill(10000)(ZIO.unit) 17 | 18 | @Benchmark 19 | def reduceAllPar(): Unit = 20 | unsafeRun(ZIO.reduceAllPar(a, as)((_, _) => ())) 21 | 22 | @Benchmark 23 | def naiveReduceAllPar(): Unit = 24 | unsafeRun(naiveReduceAllPar(a, as)((_, _) => ())) 25 | 26 | def naiveReduceAllPar[R, R1 <: R, E, A](a: ZIO[R, E, A], as: Iterable[ZIO[R1, E, A]])( 27 | f: (A, A) => A 28 | ): ZIO[R1, E, A] = 29 | as.foldLeft[ZIO[R1, E, A]](a)((l, r) => l.zipPar(r).map(f.tupled)) 30 | } 31 | -------------------------------------------------------------------------------- /benchmarks/src/main/scala/zio/stm/TSetOpsBenchmarks.scala: -------------------------------------------------------------------------------- 1 | package zio.stm 2 | 3 | import org.openjdk.jmh.annotations.{Scope => JScope, _} 4 | import zio._ 5 | 6 | import java.util.concurrent.TimeUnit 7 | 8 | @State(JScope.Thread) 9 | @BenchmarkMode(Array(Mode.Throughput)) 10 | @OutputTimeUnit(TimeUnit.SECONDS) 11 | @Measurement(iterations = 15, timeUnit = TimeUnit.SECONDS, time = 10) 12 | @Warmup(iterations = 15, timeUnit = TimeUnit.SECONDS, time = 10) 13 | @Fork(1) 14 | class TSetOpsBenchmarks { 15 | import BenchmarkUtil.unsafeRun 16 | 17 | @Param(Array("10", "100", "10000", "100000")) 18 | var size: Int = _ 19 | 20 | private var set: TSet[Int] = _ 21 | 22 | @Setup(Level.Trial) 23 | def setup(): Unit = { 24 | val data = (1 to size).toList 25 | set = unsafeRun(TSet.fromIterable(data).commit) 26 | } 27 | 28 | @Benchmark 29 | def union(): Unit = unsafeRun(set.union(set).commit) 30 | } 31 | -------------------------------------------------------------------------------- /core-tests/jvm-native/src/test/scala/zio/internal/SingleThreadedRingBufferSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import zio._ 4 | import zio.test.Assertion._ 5 | import zio.test._ 6 | 7 | object SingleThreadedRingBufferSpec extends ZIOBaseSpec { 8 | 9 | def spec = 10 | suite("SingleThreadedRingBufferSpec")( 11 | test("use SingleThreadedRingBuffer as a sliding buffer") { 12 | check(Gen.chunkOf(Gen.int), Gen.size) { (as, n) => 13 | val queue = SingleThreadedRingBuffer[Int](n) 14 | as.foreach(queue.put) 15 | val actual = queue.toChunk 16 | val expected = as.takeRight(n) 17 | assert(actual)(equalTo(expected)) 18 | } 19 | } 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /core-tests/jvm/src/test/scala/zio/MetricsSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.metrics.jvm.DefaultJvmMetrics 4 | import zio.test._ 5 | 6 | object MetricsSpec extends ZIOBaseSpec { 7 | 8 | def spec: Spec[Any, Any] = suite("MetricsSpec")( 9 | suite("Attach default JVM metrics to a layer and check that")( 10 | test("The layer can be interrupted") { 11 | val run = 12 | for { 13 | latch <- Promise.make[Nothing, Unit] 14 | frk = (latch.succeed(()) *> ZIO.never).provideLayer(DefaultJvmMetrics.liveV2.unit) 15 | _ <- frk.forkDaemon.flatMap(f => latch.await *> f.interrupt *> f.await) 16 | } yield () 17 | 18 | run *> assertCompletes 19 | } 20 | ) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-2.13/ChunkSpecVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | import scala.collection.Factory 6 | 7 | object ChunkSpecVersionSpecific extends ZIOBaseSpec { 8 | 9 | def spec = suite("ChunkSpecVersionSpecific")( 10 | test("to") { 11 | val list = List(1, 2, 3) 12 | val chunk = Chunk(1, 2, 3) 13 | assertTrue(list.to(Chunk) == chunk) 14 | }, 15 | test("factory") { 16 | val list = List(1, 2, 3) 17 | val chunk = Chunk(1, 2, 3) 18 | val factory = implicitly[Factory[Int, Chunk[Int]]] 19 | assertTrue(factory.fromSpecific(list) == chunk) 20 | } 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-2/scala/annotation/experimental.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package scala 18 | package annotation 19 | 20 | /** 21 | * For Scala 3 compatibility 22 | */ 23 | class experimental extends StaticAnnotation 24 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-3/zio/ExperimentalSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | import scala.annotation.experimental 6 | import scala.language.experimental.saferExceptions 7 | 8 | @experimental 9 | object ExperimentalSpec extends ZIOBaseSpec { 10 | 11 | import zio.Experimental._ 12 | 13 | val limit = 10e9 14 | class LimitExceeded extends Exception 15 | def f(x: Double): Double throws LimitExceeded = 16 | if x < limit then x * x else throw LimitExceeded() 17 | 18 | def spec = suite("ExperimentalSpec")( 19 | test("fromThrows success case") { 20 | for { 21 | value <- ZIO.fromThrows(f(42)) 22 | } yield assertTrue(value == 1764.0) 23 | }, 24 | test("fromThrows failure case") { 25 | for { 26 | value <- ZIO.fromThrows(f(limit + 1)).orElseSucceed("too large") 27 | } yield assertTrue(value == "too large") 28 | } 29 | ) 30 | } 31 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-3/zio/InlineScopeTestSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | import zio.test.Assertion._ 5 | import zio.Random 6 | import zio.test.Gen._ 7 | 8 | object AnObject { 9 | def bar: Int = 1 10 | } 11 | 12 | object AnotherObject { 13 | opaque type ATypeIsNeeded = Unit 14 | val AnAlias = AnObject 15 | inline def foo(): Int = AnAlias.bar 16 | } 17 | 18 | object InlineScopeTestSpec extends ZIOBaseSpec { 19 | 20 | def spec = 21 | suite("Inline Scope Spec")( 22 | test("Inline scope is captured") { 23 | assertTrue(AnotherObject.foo() == 1) 24 | } 25 | ) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-3/zio/OpaqueTypeTagsSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.* 4 | 5 | object OpaqueTypeTagsSpec extends ZIOBaseSpec { 6 | 7 | object UserName { 8 | opaque type T = String 9 | def apply(s: String): T = s"UserName: $s" 10 | } 11 | 12 | type UserName = UserName.T 13 | 14 | object UserId { 15 | opaque type T = String 16 | def apply(s: String): T = s"UserId: $s" 17 | } 18 | 19 | type UserId = UserId.T 20 | 21 | def spec = 22 | suite("OpaqueTypeTagsSpec")( 23 | test("extracts opaque types from environment") { 24 | val f = for { 25 | n <- ZIO.service[UserName.T] 26 | i <- ZIO.service[UserId.T] 27 | } yield assertTrue(n.toString == "UserName: foo", i.toString == "UserId: bar") 28 | 29 | f.provide(ZLayer.succeed(UserName("foo")), ZLayer.succeed(UserId("bar"))) 30 | } 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-3/zio/ProvideSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | object ProvideSpec extends ZIOBaseSpec { 6 | 7 | def spec = suite("ProvideSpec")( 8 | suite("provideSomeAuto")( 9 | test("Should infer the environment type") { 10 | class A(scope: Scope, string: String, int: Int) 11 | object A { 12 | val layer = ZLayer.derive[A] 13 | } 14 | 15 | class B(a: A) 16 | object B { 17 | val layer = ZLayer.derive[B] 18 | } 19 | 20 | val program = (for { 21 | _ <- ZIO.service[B] 22 | } yield ()) 23 | .provideSomeAuto( 24 | A.layer, 25 | B.layer 26 | ) 27 | 28 | // Verify correct type 29 | val p: ZIO[zio.Scope & String & Int, Any, Unit] = program 30 | 31 | assertCompletes 32 | } 33 | ) 34 | ) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala-3/zio/UnsafeSpecVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | object UnsafeSpecVersionSpecific extends ZIOBaseSpec { 6 | 7 | def spec = suite("UnsafeSpecVersionSpecific") { 8 | suite("unsafely")( 9 | test("provides capability to method with implicit parameter") { 10 | Unsafe.unsafely(doSomethingUnsafe()) 11 | assertCompletes 12 | }, 13 | test("provides capability to implicit function") { 14 | def succeed[A](block: Unsafe ?=> A): ZIO[Any, Nothing, A] = 15 | ZIO.succeed(Unsafe.unsafely(block)) 16 | assertCompletes 17 | }, 18 | test("provides capability to implicit function with multiple parameters") { 19 | val result = Unsafe.unsafely { 20 | Runtime.default.unsafe.run(ZIO.succeed(42)).getOrThrowFiberFailure() 21 | } 22 | assertTrue(result == 42) 23 | } 24 | ) 25 | } 26 | 27 | def doSomethingUnsafe()(implicit unsafe: Unsafe): Unit = 28 | () 29 | } 30 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/REPLSpec.scala: -------------------------------------------------------------------------------- 1 | import zio.test._ 2 | 3 | import scala.annotation.nowarn 4 | 5 | object REPLSpec extends ZIOSpecDefault { 6 | 7 | def spec = suite("REPLSpec")( 8 | test("settings compile") { 9 | import zio._ 10 | @nowarn("msg=never used") 11 | implicit class RunSyntax[A](io: ZIO[Any, Any, A]) { 12 | def unsafeRun: A = 13 | Unsafe.unsafe { implicit unsafe => 14 | Runtime.default.unsafe.run(io).getOrThrowFiberFailure() 15 | } 16 | } 17 | assertCompletes 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/BracketTypeInferrenceSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | object AcquireReleaseWithTypeInferenceSpec { 4 | class A 5 | class B 6 | class R1 7 | class R2 8 | class R3 9 | class E 10 | class E1 extends E 11 | class E2 extends E 12 | 13 | def infersRType3: ZIO[R1 with R2 with R3, E, B] = { 14 | val acquire: ZIO[R1, E1, A] = ??? 15 | val release: A => ZIO[R2, Nothing, Any] = ??? 16 | val use: A => ZIO[R3, E2, B] = ??? 17 | ZIO.acquireReleaseWith(acquire)(release)(use) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/CanFailSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test.Assertion._ 4 | import zio.test._ 5 | 6 | object CanFailSpec extends ZIOBaseSpec { 7 | 8 | def spec = suite("CanFailSpec")( 9 | test("useful combinators compile") { 10 | val result = typeCheck { 11 | """ 12 | import zio._ 13 | val io = ZIO.attempt("io") 14 | val uio = ZIO.succeed("uio") 15 | io.orElse(uio) 16 | """ 17 | } 18 | assertZIO(result)(isRight(anything)) 19 | } @@ TestAspect.scala2Only, 20 | test("useless combinators don't compile") { 21 | val result = typeCheck { 22 | """ 23 | import zio._ 24 | val io = ZIO.attempt("io") 25 | val uio = ZIO.succeed("uio") 26 | uio.orElse(io) 27 | """ 28 | } 29 | assertZIO(result)(isLeft(anything)) 30 | } 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/FiberIdSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test.Assertion._ 4 | import zio.test.TestAspect._ 5 | import zio.test._ 6 | 7 | object FiberIdSpec extends ZIOBaseSpec { 8 | 9 | def spec = suite("FiberIdSpec")( 10 | suite("stack safety")( 11 | test("ids") { 12 | assert(fiberId.ids.size)(equalTo(20000)) 13 | }, 14 | test("isNone") { 15 | assert(fiberId.isNone)(equalTo(false)) 16 | }, 17 | test("toSet") { 18 | assert(fiberId.toSet.size)(equalTo(20000)) 19 | } 20 | ) @@ sequential @@ jvmOnly 21 | ) 22 | 23 | val fiberId: FiberId = { 24 | def runtimeFiber(i: Int): FiberId = FiberId.Runtime(i, i.toLong, Trace.empty) 25 | 26 | val left = (2 to 10000).foldLeft(runtimeFiber(1))((id, i) => id <> runtimeFiber(i)) 27 | val right = (10002 to 20000).foldLeft(runtimeFiber(10001))((id, i) => id <> runtimeFiber(i)) 28 | left <> right 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/ImportlessSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | object ImportlessSpec extends ZIOBaseSpec { 6 | val spec = suite("Suite")( 7 | test("This is a test without imports")(assertCompletes), 8 | test("This is an effectful test without imports")(ZIO.succeed(assertCompletes)) 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/LatchOps.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | trait LatchOps { 4 | def withLatch[R, E, A](f: UIO[Unit] => ZIO[R, E, A]): ZIO[R, E, A] = 5 | Promise.make[Nothing, Unit] flatMap (latch => f(latch.succeed(()).unit) <* latch.await) 6 | 7 | def withLatch[R, E, A](f: (UIO[Unit], UIO[Unit]) => ZIO[R, E, A]): ZIO[R, E, A] = 8 | for { 9 | ref <- Ref.make(true) 10 | latch <- Promise.make[Nothing, Unit] 11 | a <- f(latch.succeed(()).unit, ZIO.uninterruptibleMask(restore => ref.set(false) *> restore(latch.await))) 12 | _ <- ZIO.whenZIO(ref.get)(latch.await) 13 | } yield a 14 | } 15 | 16 | object LatchOps extends LatchOps 17 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/TaggedSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test.Assertion._ 4 | import zio.test.TestAspect.exceptScala3 5 | import zio.test._ 6 | 7 | object TaggedSpec extends ZIOBaseSpec { 8 | 9 | def spec: Spec[Any, TestFailure[Any]] = suite("TaggedSpec")( 10 | test("tags can be derived for polymorphic services") { 11 | val result = typeCheck { 12 | """ 13 | trait Producer[R, K, V] 14 | 15 | def test[R: Tag, K: Tag, V: Tag]: Boolean = { 16 | val _ = implicitly[Tag[Producer[R, K, V]]] 17 | true 18 | } 19 | """ 20 | } 21 | assertZIO(result)(isRight(isUnit)) 22 | } @@ exceptScala3 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/UnsafeSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | object UnsafeSpec extends ZIOBaseSpec { 6 | 7 | def spec = suite("UnsafeSpec") { 8 | suite("unsafe")( 9 | test("provides capability to function") { 10 | Unsafe.unsafe { implicit unsafe => 11 | doSomethingUnsafe() 12 | } 13 | assertCompletes 14 | } 15 | ) 16 | } 17 | 18 | def doSomethingUnsafe()(implicit unsafe: Unsafe): Unit = 19 | () 20 | } 21 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/ZEnvironmentIssuesSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | import zio.test.TestAspect._ 5 | 6 | object ZEnvironmentIssuesSpec extends ZIOBaseSpec { 7 | 8 | def spec = suite("ZEnvironmentIssuesSpec")( 9 | test("Providing a subtype") { 10 | trait Animal 11 | trait Dog extends Animal 12 | 13 | // Accesses an Animal 14 | val zio: URIO[Animal, Animal] = ZIO.service[Animal] 15 | 16 | // Provides a Dog 17 | val dog: Dog = new Dog {} 18 | val dogService: ULayer[Dog] = ZLayer.succeed(dog) 19 | 20 | zio.provideLayer(dogService).map { result => 21 | assertTrue(result == dog) 22 | } 23 | } @@ ignore, 24 | test("tags") { 25 | def tagForThing[A](value: A)(implicit tag: EnvironmentTag[A]): EnvironmentTag[A] = { 26 | val _ = value 27 | tag 28 | } 29 | assertTrue(tagForThing(Clock.ClockLive).tag <:< EnvironmentTag[Clock].tag) 30 | } @@ exceptScala3 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/ZIOAspectSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | import zio.test.TestAspect._ 5 | 6 | object ZIOAspectSpec extends ZIOBaseSpec { 7 | import ZIOAspect._ 8 | 9 | def spec = suite("ZIOAspectSpec")( 10 | test("nested nests configuration under the specified name") { 11 | for { 12 | config <- ZIO.config(Config.string("key")) @@ nested("nested") 13 | } yield assertTrue(config == "value") 14 | } @@ withConfigProvider(ConfigProvider.fromMap(Map("nested.key" -> "value"))) 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/ZStateSpec.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.test._ 4 | 5 | object ZStateSpec extends ZIOBaseSpec { 6 | 7 | def spec = 8 | suite("ZStateSpec")( 9 | test("state can be updated") { 10 | ZIO.stateful(0) { 11 | for { 12 | _ <- ZIO.updateState[Int](_ + 1) 13 | state <- ZIO.getState[Int] 14 | } yield assertTrue(state == 1) 15 | } 16 | } 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /core-tests/shared/src/test/scala/zio/stm/STMLazinessSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.stm 2 | 3 | import zio.test._ 4 | import zio.{UIO, ZIO, ZIOBaseSpec} 5 | 6 | object STMLazinessSpec extends ZIOBaseSpec { 7 | 8 | def assertLazy(f: (=> Nothing) => Any): UIO[TestResult] = 9 | ZIO.succeed { 10 | val _ = f(throw new RuntimeException("not lazy")) 11 | assertCompletes 12 | } 13 | 14 | def spec = suite("STMLazinessSpec")( 15 | test("check")(assertLazy(ZSTM.check)), 16 | test("die")(assertLazy(ZSTM.die)), 17 | test("dieMessage")(assertLazy(ZSTM.dieMessage)), 18 | test("done")(assertLazy(ZSTM.done)), 19 | test("fail")(assertLazy(ZSTM.fail)), 20 | test("fromEither")(assertLazy(ZSTM.fromEither)), 21 | test("fromTry")(assertLazy(ZSTM.fromTry)), 22 | test("succeed")(assertLazy(ZSTM.succeed)) 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /core/js-native/src/main/scala/zio/ClockSyntaxPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import java.time.temporal.ChronoUnit 4 | import java.util.concurrent.TimeUnit 5 | 6 | private[zio] trait ClockSyntaxPlatformSpecific { 7 | final protected def toChronoUnit(unit: TimeUnit): ChronoUnit = 8 | unit match { 9 | case TimeUnit.NANOSECONDS => ChronoUnit.NANOS 10 | case TimeUnit.MICROSECONDS => ChronoUnit.MICROS 11 | case TimeUnit.MILLISECONDS => ChronoUnit.MILLIS 12 | case TimeUnit.SECONDS => ChronoUnit.SECONDS 13 | case TimeUnit.MINUTES => ChronoUnit.MINUTES 14 | case TimeUnit.HOURS => ChronoUnit.HOURS 15 | case TimeUnit.DAYS => ChronoUnit.DAYS 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/ExecutorPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait ExecutorPlatformSpecific 22 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/FiberPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait FiberPlatformSpecific 22 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/QueuePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | private[zio] trait QueuePlatformSpecific { 4 | // java.util.concurrent.ConcurrentLinkedDeque is not available in ScalaJS or Scala Native, so we use an ArrayDeque instead 5 | type ConcurrentDeque[A] = java.util.ArrayDeque[A] 6 | } 7 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/internal/Blocking.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal 18 | 19 | object Blocking { 20 | private[zio] final def signalBlocking(): Unit = () 21 | } 22 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/internal/DefaultExecutors.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] abstract class DefaultExecutors 22 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/internal/Sync.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] object Sync { 22 | @inline def apply[A](anyRef: AnyRef)(f: => A): A = { 23 | val _ = anyRef 24 | f 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/internal/WeakConcurrentBagGc.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import zio.Duration 4 | 5 | private object WeakConcurrentBagGc { 6 | def start[A <: AnyRef](bag: WeakConcurrentBag[A], every: Duration): Unit = () 7 | } 8 | -------------------------------------------------------------------------------- /core/js/src/main/scala/zio/stm/ZSTMLockSupport.scala: -------------------------------------------------------------------------------- 1 | package zio.stm 2 | 3 | private object ZSTMLockSupport { 4 | 5 | final class Lock 6 | object Lock { 7 | def apply(fair: Boolean = false): Lock = new Lock 8 | } 9 | 10 | @inline def lock[A](refs: collection.SortedSet[TRef[?]])(f: => A): Boolean = { 11 | val _ = f 12 | true 13 | } 14 | 15 | @inline def tryLock[A](refs: collection.SortedSet[TRef[?]])(f: => A): Boolean = { 16 | val _ = f 17 | true 18 | } 19 | 20 | @inline def tryLock[A](lock: Lock)(f: => A): Boolean = { 21 | val _ = f 22 | true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/jvm-native/src/main/scala/zio/internal/Sync.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] object Sync { 22 | def apply[A](anyRef: AnyRef)(f: => A): A = anyRef.synchronized(f) 23 | } 24 | -------------------------------------------------------------------------------- /core/jvm/src/main/resources/META-INF/native-image/dev.zio/zio/native-image.properties: -------------------------------------------------------------------------------- 1 | Args = -H:DynamicProxyConfigurationResources=${.}/sun-misc-signal-proxy-config.json 2 | -------------------------------------------------------------------------------- /core/jvm/src/main/resources/META-INF/native-image/dev.zio/zio/sun-misc-signal-proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaces": [ 4 | "sun.misc.SignalHandler" 5 | ] 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /core/jvm/src/main/scala/zio/ClockSyntaxPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import java.time.temporal.ChronoUnit 4 | import java.util.concurrent.TimeUnit 5 | 6 | private[zio] trait ClockSyntaxPlatformSpecific { 7 | @inline final protected def toChronoUnit(unit: TimeUnit): ChronoUnit = 8 | unit.toChronoUnit 9 | } 10 | -------------------------------------------------------------------------------- /core/jvm/src/main/scala/zio/QueuePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | private[zio] trait QueuePlatformSpecific { 4 | type ConcurrentDeque[A] = java.util.concurrent.ConcurrentLinkedDeque[A] 5 | } 6 | -------------------------------------------------------------------------------- /core/jvm/src/main/scala/zio/internal/metrics/AddersVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.metrics 2 | 3 | private[zio] trait AddersVersionSpecific { 4 | type DoubleAdder = java.util.concurrent.atomic.DoubleAdder 5 | } 6 | -------------------------------------------------------------------------------- /core/jvm/src/main/scala/zio/metrics/jvm/JvmMetricsSchedule.scala: -------------------------------------------------------------------------------- 1 | package zio.metrics.jvm 2 | 3 | import zio._ 4 | 5 | /** 6 | * Configuration for the JVM metrics 7 | * 8 | * @param updateMetrics 9 | * Schedule for periodically updating each JVM metric 10 | * @param reloadDynamicMetrics 11 | * Schedule for regenerating the dynamic JVM metrics such as buffer pool 12 | * metrics 13 | */ 14 | final case class JvmMetricsSchedule( 15 | updateMetrics: Schedule[Any, Any, Any], 16 | reloadDynamicMetrics: Schedule[Any, Any, Any] 17 | ) 18 | 19 | object JvmMetricsSchedule { 20 | val default: ULayer[JvmMetricsSchedule] = 21 | ZLayer.succeed(JvmMetricsSchedule(Schedule.fixed(10.seconds), Schedule.fixed(1.minute))) 22 | } 23 | -------------------------------------------------------------------------------- /core/native/src/main/scala/zio/FiberPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait FiberPlatformSpecific 22 | -------------------------------------------------------------------------------- /core/native/src/main/scala/zio/QueuePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import java.util.concurrent.ConcurrentLinkedQueue 4 | import scala.collection.mutable 5 | 6 | private[zio] trait QueuePlatformSpecific { 7 | 8 | // java.util.concurrent.ConcurrentLinkedDeque is not available in Scala Native, so we need to createa custom `addFirst` method 9 | private[zio] final class ConcurrentDeque[A <: AnyRef] extends ConcurrentLinkedQueue[A] { 10 | 11 | def addFirst(a: A): Unit = { 12 | var popped = poll() 13 | if (popped eq null) { 14 | offer(a) 15 | } else { 16 | val buf = new mutable.ArrayBuffer[A] 17 | while (popped ne null) { 18 | buf += popped 19 | popped = poll() 20 | } 21 | offer(a) 22 | buf.foreach(offer) 23 | } 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/native/src/main/scala/zio/TaskPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait TaskPlatformSpecific 22 | -------------------------------------------------------------------------------- /core/native/src/main/scala/zio/ZIOPlatformSpecificJVM.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | private[zio] trait ZIOPlatformSpecificJVM 4 | -------------------------------------------------------------------------------- /core/native/src/main/scala/zio/internal/metrics/AddersVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.metrics 2 | 3 | private[zio] trait AddersVersionSpecific { 4 | protected final class DoubleAdder { 5 | private val ref = AtomicDouble.make(0.0d) 6 | 7 | def add(v: Double): Unit = ref.updateAndGet(_ + v) 8 | def sum(): Double = ref.get() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2.12/zio/internal/MutableSetCompat.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import scala.collection.mutable 4 | 5 | trait MutableSetCompat[V] extends mutable.Set[V] { 6 | 7 | override def +=(element: V): this.type = { 8 | add(element) 9 | this 10 | } 11 | 12 | override def -=(element: V): this.type = { 13 | remove(element) 14 | this 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2.12/zio/stm/ZSTMUtils.scala: -------------------------------------------------------------------------------- 1 | package zio.stm 2 | 3 | import scala.collection.{mutable, SortedSet, immutable} 4 | 5 | private object ZSTMUtils { 6 | 7 | def newMutableMap[K, V](expectedNumElements: Int): mutable.HashMap[K, V] = { 8 | val map = new mutable.HashMap[K, V] 9 | if (expectedNumElements > 0) map.sizeHint(expectedNumElements) 10 | map 11 | } 12 | 13 | def newImmutableTreeSet[A](set: SortedSet[A])(implicit ord: Ordering[A]): immutable.TreeSet[A] = 14 | immutable.TreeSet.empty[A] ++ set 15 | 16 | } 17 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2.13+/zio/internal/MutableSetCompat.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import scala.collection.mutable 4 | 5 | trait MutableSetCompat[V] extends mutable.Set[V] { 6 | 7 | override def addOne(element: V): this.type = { 8 | add(element) 9 | this 10 | } 11 | 12 | override def subtractOne(element: V): this.type = { 13 | remove(element) 14 | this 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2.13+/zio/stm/ZSTMUtils.scala: -------------------------------------------------------------------------------- 1 | package zio.stm 2 | 3 | import scala.collection.{mutable, SortedSet, immutable} 4 | 5 | private object ZSTMUtils { 6 | 7 | def newMutableMap[K, V](expectedNumElements: Int): mutable.HashMap[K, V] = { 8 | val size = if (expectedNumElements <= 3) 4 else Math.ceil(expectedNumElements / 0.75d).toInt 9 | new mutable.HashMap[K, V](size, 0.75d) 10 | } 11 | 12 | @inline def newImmutableTreeSet[A](set: SortedSet[A])(implicit ord: Ordering[A]): immutable.TreeSet[A] = 13 | immutable.TreeSet.from(set) 14 | 15 | } 16 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2/zio/IntersectionTypeCompat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait IntersectionTypeCompat { 22 | type &[+A, +B] = A with B 23 | } 24 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2/zio/ServiceTagVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | private[zio] trait TagVersionSpecific { 4 | implicit def materialize[A]: Tag[A] = 5 | macro zio.internal.macros.InternalMacros.materializeTag[A] 6 | } 7 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2/zio/UnsafeVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package zio 17 | 18 | private[zio] trait UnsafeVersionSpecific 19 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2/zio/ZIOAppVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | private[zio] trait ZIOAppVersionSpecific { 4 | 5 | /** 6 | * This implicit conversion macro will ensure that the provided ZIO effect 7 | * does not require more than the provided environment. 8 | * 9 | * If it is missing requirements, it will report a descriptive error message. 10 | * Otherwise, the effect will be returned unmodified. 11 | */ 12 | implicit def validateEnv[R1, R, E, A](zio: ZIO[R, E, A]): ZIO[R1, E, A] = 13 | macro internal.macros.LayerMacros.validate[R1, R] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-2/zio/ZLayerVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.internal.macros.ZLayerMakeMacros 4 | 5 | private[zio] trait ZLayerVersionSpecific[-R, +E, +A] { self: ZLayer[R, E, A] => 6 | 7 | def runWith[E1 >: E](layers: ZLayer[_, E1, _]*)(implicit ev: A IsSubtypeOfOutput Unit): ZIO[Any, E1, Unit] = 8 | macro ZLayerMakeMacros.runWithImpl[R, E1, A] 9 | 10 | } 11 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-3/zio/IntersectionTypeCompat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | transparent private[zio] trait IntersectionTypeCompat 22 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-3/zio/UnsafeVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package zio 17 | 18 | private[zio] transparent trait UnsafeVersionSpecific { 19 | 20 | def unsafely[A](f: Unsafe ?=> A): A = 21 | f(using Unsafe) 22 | 23 | implicit def implicitFunctionIsFunction[A](f: Unsafe ?=> A): Unsafe => A = 24 | _ => f(using Unsafe) 25 | } 26 | -------------------------------------------------------------------------------- /core/shared/src/main/scala-3/zio/ZLayerVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | import zio.internal.macros.LayerMacros 4 | 5 | private[zio] transparent trait ZLayerVersionSpecific[-R, +E, +A] { self: ZLayer[R, E, A] => 6 | inline def runWith[E1 >: E]( 7 | inline layer: ZLayer[_, E1, _]* 8 | )(using ev: A IsSubtypeOfOutput Unit): ZIO[Any, E1, Unit] = 9 | ${ LayerMacros.runWithImpl[R, E1]('{ self.asInstanceOf[ZLayer[R, E, Unit]] }, 'layer) } 10 | } 11 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/EitherCompat.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[zio] trait EitherCompat {} 22 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/ExitCode.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | final case class ExitCode(code: Int) 22 | 23 | object ExitCode { 24 | val success: ExitCode = ExitCode(0) 25 | val failure: ExitCode = ExitCode(1) 26 | } 27 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/HasNoScope.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | @scala.annotation.implicitNotFound( 4 | """Can not prove that ${R} does not contain Scope. 5 | If ${R} contains a zio.Scope, please handle it explicitly. If it contains a generic type, add a context bound 6 | like def myMethod[R: HasNoScope](...) = ...""" 7 | ) 8 | sealed trait HasNoScope[R] 9 | 10 | object HasNoScope extends HasNoScopeCompanionVersionSpecific { 11 | override val instance: HasNoScope[Any] = new HasNoScope[Any] {} 12 | } 13 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/LogAnnotation.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio 18 | 19 | /** 20 | * A `LogAnnotation` represents a key value pair that allows annotating logs 21 | * with additional information. 22 | */ 23 | final case class LogAnnotation(key: String, value: String) 24 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/NonEmptySeq.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | trait NonEmptySeq[+A, CC[+_], EC[+_]] extends NonEmptyOps[A, CC, EC] { 4 | def appended[B >: A](elem: B): CC[B] 5 | def collectFirst[B](pf: PartialFunction[A, B]): Option[B] 6 | def distinct: CC[A] 7 | def prepended[B >: A](elem: B): CC[B] 8 | def reverse: CC[A] 9 | def sortBy[B](f: A => B)(implicit ord: Ordering[B]): CC[A] 10 | def sorted[B >: A](implicit ord: Ordering[B]): CC[B] 11 | } 12 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/UpdateRuntimeFlagsWithinPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | // Kept for compatibility purposes only 4 | private trait UpdateRuntimeFlagsWithinPlatformSpecific {} 5 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/FiberRunnable.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import zio._ 4 | import zio.stacktracer.TracingImplicits.disableAutoTrace 5 | 6 | private[zio] trait FiberRunnable extends Runnable { 7 | def location: Trace 8 | 9 | def run(depth: Int): Unit 10 | } 11 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/Platform.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | import zio.stacktracer.TracingImplicits.disableAutoTrace 4 | 5 | import scala.concurrent.ExecutionContext 6 | 7 | /* 8 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | object Platform extends PlatformSpecific 24 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/SpecializationHelpers.scala: -------------------------------------------------------------------------------- 1 | package zio.internal 2 | 3 | private[zio] object SpecializationHelpers { 4 | final val SpecializeInt: Specializable.Group[Tuple1[Int]] = null 5 | } 6 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/macros/DummyK.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.macros 2 | 3 | /** 4 | * DummyK is used to pull `WeakTypeTag` information into a Macro when there is 5 | * otherwise no value to extract it from. See: [[ZLayerMakeMacros.makeImpl]] 6 | */ 7 | private[zio] final case class DummyK[A]() 8 | 9 | private[zio] object DummyK { 10 | private val singleton: DummyK[Any] = DummyK() 11 | implicit def dummyK[A]: DummyK[A] = singleton.asInstanceOf[DummyK[A]] 12 | } 13 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/macros/GraphError.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.macros 2 | 3 | import zio.Chunk 4 | 5 | sealed trait GraphError[+Key, +A] 6 | 7 | object GraphError { 8 | def missingTransitiveDependency[Key, A](node: Node[Key, A], dependency: Key): GraphError[Key, A] = 9 | MissingTransitiveDependencies(node, Chunk(dependency)) 10 | 11 | case class MissingTransitiveDependencies[+Key, +A](node: Node[Key, A], dependency: Chunk[Key]) 12 | extends GraphError[Key, A] 13 | 14 | case class MissingTopLevelDependency[+Key](requirement: Key) extends GraphError[Key, Nothing] 15 | 16 | case class CircularDependency[+Key, +A](node: Node[Key, A], dependency: Node[Key, A], depth: Int = 0) 17 | extends GraphError[Key, A] 18 | } 19 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/macros/Node.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.macros 2 | 3 | final case class Node[+Key, +A](inputs: List[Key], outputs: List[Key], value: A) { 4 | def map[B](f: A => B): Node[Key, B] = copy(value = f(value)) 5 | } 6 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/metrics/ConcurrentMetricHooks.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.metrics 2 | 3 | import zio.metrics._ 4 | 5 | private[zio] trait ConcurrentMetricHooks { 6 | def counter(key: MetricKey.Counter): MetricHook.Counter 7 | 8 | def gauge(key: MetricKey.Gauge, startAt: Double): MetricHook.Gauge 9 | 10 | def histogram(key: MetricKey.Histogram): MetricHook.Histogram 11 | 12 | def summary(key: MetricKey.Summary): MetricHook.Summary 13 | 14 | def frequency(key: MetricKey.Frequency): MetricHook.Frequency 15 | } 16 | private[zio] object ConcurrentMetricHooks extends ConcurrentMetricHooksPlatformSpecific 17 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/internal/metrics/MetricEventType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal.metrics 18 | 19 | private[zio] sealed trait MetricEventType 20 | 21 | private[zio] object MetricEventType { 22 | case object Modify extends MetricEventType 23 | case object Update extends MetricEventType 24 | } 25 | -------------------------------------------------------------------------------- /core/shared/src/main/scala/zio/metrics/MetricListener.scala: -------------------------------------------------------------------------------- 1 | package zio.metrics 2 | 3 | import zio.Unsafe 4 | 5 | private[zio] trait MetricListener { 6 | def modifyGauge(key: MetricKey[MetricKeyType.Gauge], value: Double)(implicit unsafe: Unsafe): Unit 7 | def updateHistogram(key: MetricKey[MetricKeyType.Histogram], value: Double)(implicit unsafe: Unsafe): Unit 8 | def updateGauge(key: MetricKey[MetricKeyType.Gauge], value: Double)(implicit unsafe: Unsafe): Unit 9 | def updateFrequency(key: MetricKey[MetricKeyType.Frequency], value: String)(implicit unsafe: Unsafe): Unit 10 | def updateSummary(key: MetricKey[MetricKeyType.Summary], value: Double, instant: java.time.Instant)(implicit 11 | unsafe: Unsafe 12 | ): Unit 13 | def updateCounter(key: MetricKey[MetricKeyType.Counter], value: Double)(implicit unsafe: Unsafe): Unit 14 | } 15 | -------------------------------------------------------------------------------- /docs/ecosystem/community/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "ZIO Ecosystem Community Libraries" 4 | --- 5 | 6 | In this section we are going to introduce some of the most important libraries that have first-class ZIO support from the community. 7 | 8 | If you know a useful library that has first-class ZIO support, please consider [submitting a pull request](https://github.com/zio/zio/pulls) to add it to this list. 9 | 10 | 11 | import DocCardList from '@theme/DocCardList'; 12 | 13 | <DocCardList /> -------------------------------------------------------------------------------- /docs/ecosystem/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "ZIO Ecosystem" 4 | --- 5 | import Ecosystem from '@site/src/components/sections/Ecosystem'; 6 | 7 | ZIO has a rich ecosystem of libraries and tools that enhance its capabilities and provide additional functionality. This ecosystem includes libraries for various purposes, such as web development, data processing, testing, and more. 8 | 9 | But it doesn't end there! If you need a comprehensive list of libraries and tools, you can find them in one of the following sections: 10 | 11 | - [Official libraries](officials/index.md), maintained by the ZIO team under the [ZIO Organization](https://github.com/zio). 12 | - [Community libraries](community/index.md), maintained by members of the ZIO community. 13 | 14 | Below are some of the highlights from the official libraries: 15 | 16 | <Ecosystem /> 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/ecosystem/templates.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: templates 3 | title: "Project Templates" 4 | --- 5 | 6 | List of project starters, bootstrap tools or, templates. 7 | 8 | - [zio-scala2-quickstart.g8](https://github.com/ScalaConsultants/zio-scala2-quickstart.g8) — A Giter8 template for a basic Scala 2 application with a choice of libraries to use (Akka HTTP, ZIO HTTP, Quill, Slick) 9 | - [zio-scala3-quickstart.g8](https://github.com/ScalaConsultants/zio-scala3-quickstart.g8) — A Giter8 template for a basic Scala 3 application with ZIO HTTP and Quill 10 | - [zio-scala-3-project.g8](https://github.com/lachezar/zio-scala-3-project.g8) - A Giter8 template for Scala 3 + ZIO 2 web service applications using zio-http, zio-json, zio-quill, zio-kafka, zio-prelude and Onion architecure. 11 | 12 | -------------------------------------------------------------------------------- /docs/ecosystem/tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tools 3 | title: "ZIO Tools" 4 | --- 5 | 6 | - [ZIO IntelliJ](https://github.com/zio/zio-intellij) — A complementary, community-developed plugin for IntelliJ IDEA, brings enhancements when using ZIO in your projects 7 | -------------------------------------------------------------------------------- /docs/guides/interop/with-guava.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: with-guava 3 | title: "How to Interop with Guava?" 4 | sidebar_label: "Guava" 5 | --- 6 | 7 | [`interop-guava`](https://github.com/zio/interop-guava) module provide capibility to convert [Guava's `com.google.common.util.concurrent.ListenableFuture`](https://github.com/google/guava/wiki/ListenableFutureExplained) into ZIO `Task`. 8 | -------------------------------------------------------------------------------- /docs/guides/interop/with-twitter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: with-twitter 3 | title: "How to Interop with Twitter?" 4 | sidebar_label: "Twitter's Future" 5 | --- 6 | 7 | [`interop-twitter`](https://github.com/zio/interop-twitter) module provides capability to convert [Twitter `Future`](https://twitter.github.io/util/docs/com/twitter/util/Future.html) into ZIO `Task`. 8 | 9 | ### Example 10 | 11 | ```scala 12 | import com.twitter.util.Future 13 | import zio.{ App, Task } 14 | import zio.Console._ 15 | import zio.interop.twitter._ 16 | 17 | object Example extends App { 18 | def run(args: List[String]) = { 19 | val program = 20 | for { 21 | _ <- printLine("Hello! What is your name?") 22 | name <- readLine 23 | greeting <- Task.fromTwitterFuture(Task(greet(name))) 24 | _ <- printLine(greeting) 25 | } yield () 26 | 27 | program.exitCode 28 | } 29 | 30 | private def greet(name: String): Future[String] = Future.value(s"Hello, $name!") 31 | } 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/guides/migrate/from-cats-effect.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: from-cats-effect 3 | title: "How to Migrate from Cats Effect to ZIO?" 4 | sidebar_label: "Migration from Cats Effect" 5 | --- 6 | 7 | Cats `IO[A]` can be easily replaced with ZIO's `Task[A]` (an alias for `ZIO[Any, Throwable, A]`). 8 | Translation should be relatively straightforward. Below, you'll find tables showing the ZIO equivalents of 9 | various `cats.*`'s methods. 10 | 11 | ### Methods on cats.FlatMap.Ops 12 | 13 | | cats | ZIO | 14 | |----------------|------------| 15 | | `flatMap` | `flatMap` | 16 | | `flatten` | `flatten` | 17 | | `productREval` | `zipRight` | 18 | | `productLEval` | `zipLeft` | 19 | | `mproduct` | `zipPar` | 20 | | `flatTap` | `tap` | 21 | -------------------------------------------------------------------------------- /docs/guides/tutorials/img/intellij-idea-new-project-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/docs/guides/tutorials/img/intellij-idea-new-project-1.png -------------------------------------------------------------------------------- /docs/guides/tutorials/img/intellij-idea-new-project-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/docs/guides/tutorials/img/intellij-idea-new-project-2.png -------------------------------------------------------------------------------- /docs/guides/tutorials/img/intellij-idea-test-runner-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/docs/guides/tutorials/img/intellij-idea-test-runner-output.png -------------------------------------------------------------------------------- /docs/guides/tutorials/img/vscode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/docs/guides/tutorials/img/vscode.jpg -------------------------------------------------------------------------------- /docs/overview/performance.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: performance 3 | title: "Performance" 4 | --- 5 | 6 | ZIO is a high-performance framework that is powered by non-blocking fibers (which will move to _virtual threads_ under Loom). 7 | 8 | ZIO's core execution engine minimizes allocations and automatically cancels all unused computation. All data structures included with ZIO are high-performance and non-blocking, and to the maximum extent possible on the JVM, non-boxing. 9 | 10 | The `benchmarks` project has a variety of benchmarks that compare the performance of ZIO with other similar projects in the Scala and Java ecosystems, demonstrating 2-100x faster performance in some cases. 11 | 12 | Benchmarks to compare the performance of HTTP, GraphQL, RDMBS, and other ZIO integrations can be found in those respective projects. 13 | -------------------------------------------------------------------------------- /docs/reference/contextual/layer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: layer 3 | title: "Layer" 4 | --- 5 | 6 | `Layer[+E, +ROut]` is a type alias for `ZLayer[Any, E, ROut]`, which represents a layer that doesn't require any services, it may fail with an error type of `E`, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type Layer[+E, +ROut] = ZLayer[Any, E, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /docs/reference/contextual/rlayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: rlayer 3 | title: "RLayer" 4 | --- 5 | 6 | `RLayer[-RIn, +ROut]` is a type alias for `ZLayer[RIn, Throwable, ROut]`, which represents a layer that requires `RIn` as its input, it may fail with `Throwable` value, or returns `ROut` as its output. 7 | 8 | ```scala 9 | type RLayer[-RIn, +ROut] = ZLayer[RIn, Throwable, ROut] 10 | ``` -------------------------------------------------------------------------------- /docs/reference/contextual/task-layer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tasklayer 3 | title: "TaskLayer" 4 | --- 5 | 6 | `TaskLayer[+ROut]` is a type alias for `ZLayer[Any, Throwable, ROut]`, which represents a layer that doesn't require any services as its input, it may fail with `Throwable` value, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type TaskLayer[+ROut] = ZLayer[Any, Throwable, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /docs/reference/contextual/ulayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: ulayer 3 | title: "ULayer" 4 | --- 5 | 6 | `ULayer[+ROut]` is a type alias for `ZLayer[Any, Nothing, ROut]`, which represents a layer that doesn't require any services as its input, it can't fail, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type ULayer[+ROut] = ZLayer[Any, Nothing, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /docs/reference/contextual/urlayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: urlayer 3 | title: "URLayer" 4 | --- 5 | 6 | `URLayer[-RIn, +ROut]` is a type alias for `ZLayer[RIn, Nothing, ROut]`, which represents a layer that requires `RIn` as its input, it can't fail, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type URLayer[-RIn, +ROut] = ZLayer[RIn, Nothing, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /docs/reference/error-management/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Introduction to Error Management in ZIO" 4 | --- 5 | 6 | As well as providing first-class support for typed errors, ZIO has a variety of facilities for catching, propagating, and transforming errors in a typesafe manner. In this section, we will learn about different types of errors in ZIO and how we can manage them. 7 | -------------------------------------------------------------------------------- /docs/reference/error-management/operations/flattening-optional-error-types.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: flattening-optional-error-types 3 | title: "Flattening Optional Error Types" 4 | --- 5 | 6 | If we have an optional error of type `E` in the error channel, we can flatten it to the `E` type using the `ZIO#flattenErrorOption` operator: 7 | 8 | ```scala mdoc:compile-only 9 | import zio._ 10 | 11 | def parseInt(input: String): ZIO[Any, Option[String], Int] = 12 | if (input.isEmpty) 13 | ZIO.fail(Some("empty input")) 14 | else 15 | try { 16 | ZIO.succeed(input.toInt) 17 | } catch { 18 | case _: NumberFormatException => ZIO.fail(None) 19 | } 20 | 21 | def flattenedParseInt(input: String): ZIO[Any, String, Int] = 22 | parseInt(input).flattenErrorOption("non-numeric input") 23 | 24 | val r1: ZIO[Any, String, Int] = flattenedParseInt("zero") 25 | val r2: ZIO[Any, String, Int] = flattenedParseInt("") 26 | val r3: ZIO[Any, String, Int] = flattenedParseInt("123") 27 | ``` 28 | 29 | -------------------------------------------------------------------------------- /docs/reference/error-management/operations/merging-the-error-channel-into-the-success-channel.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: merging-the-error-channel-into-the-success-channel 3 | title: "Merging the Error Channel into the Success Channel" 4 | --- 5 | 6 | With `ZIO#merge` we can merge the error channel into the success channel: 7 | 8 | ```scala mdoc:compile-only 9 | import zio._ 10 | 11 | val merged : ZIO[Any, Nothing, String] = 12 | ZIO.fail("Oh uh!") // ZIO[Any, String, Nothing] 13 | .merge // ZIO[Any, Nothing, String] 14 | ``` 15 | 16 | If the error and success channels were of different types, it would choose the supertype of both. 17 | -------------------------------------------------------------------------------- /docs/reference/error-management/operations/rejecting-some-success-values.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: rejecting-some-success-values 3 | title: "Rejecting Some Success Values" 4 | --- 5 | 6 | We can reject some success values using the `ZIO#reject` operator: 7 | 8 | ```scala 9 | trait ZIO[-R, +E, +A] { 10 | def reject[E1 >: E](pf: PartialFunction[A, E1]): ZIO[R, E1, A] 11 | 12 | def rejectZIO[R1 <: R, E1 >: E]( 13 | pf: PartialFunction[A, ZIO[R1, E1, E1]] 14 | ): ZIO[R1, E1, A] 15 | } 16 | ``` 17 | 18 | If the `PartialFunction` matches, it will reject that success value and convert that to a failure, otherwise it will continue with the original success value: 19 | 20 | ```scala mdoc:compile-only 21 | import zio._ 22 | 23 | val myApp: ZIO[Any, String, Int] = 24 | Random 25 | .nextIntBounded(20) 26 | .reject { 27 | case n if n % 2 == 0 => s"even number rejected: $n" 28 | case 5 => "number 5 was rejected" 29 | } 30 | .debug 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/reference/fiber/fiberid.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fiberid 3 | title: "FiberId" 4 | --- 5 | 6 | `FiberId` is the identity of a [Fiber](fiber.md), described by a globally unique sequence number and the time when it began life: 7 | * `id` — unique monotonically increasing sequence number `0,1,2,...`, derived from an atomic counter 8 | * `startTimeSeconds` — UTC time seconds, derived from `java.lang.System.currentTimeMillis / 1000` 9 | -------------------------------------------------------------------------------- /docs/reference/fiber/fiberstatus.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fiberstatus 3 | title: "Fiber.Status" 4 | --- 5 | 6 | `Fiber.Status` describes the current status of a [Fiber](fiber.md). 7 | 8 | Each fiber can be in one of the following status: 9 | 10 | - Done 11 | - Running 12 | - Suspended 13 | 14 | In the following example, we are going to `await` on a never-ending fiber and determine the id of that fiber, which we are blocking on: 15 | 16 | ```scala mdoc:silent 17 | import zio._ 18 | 19 | for { 20 | f1 <- ZIO.never.fork 21 | f2 <- f1.await.fork 22 | blockingOn <- f2.status 23 | .collect(()) { case Fiber.Status.Suspended(_, _, blockingOn) => 24 | blockingOn 25 | } 26 | .eventually 27 | } yield (assert(blockingOn == f1.id)) 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/reference/observability/tracing.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tracing 3 | title: "Introduction to Tracing in ZIO" 4 | sidebar_label: "Tracing" 5 | --- 6 | 7 | Although logs and metrics are useful for understanding the behavior of individual services, they are not enough to provide a complete overview of the lifetime of a request in a distributed system. 8 | 9 | In a distributed system, a request can span multiple services and each service can make multiple requests to other services to fulfill the request. In such a scenario, we need to have a way to track the lifetime of a request across multiple services to diagnose what services are the bottlenecks and where the request is spending most of its time. 10 | 11 | ZIO Telemetry supports tracing through the OpenTelemetry API. To learn more about tracing, please refer to the [ZIO Telemetry documentation](https://zio.dev/zio-telemetry/opentracing). 12 | -------------------------------------------------------------------------------- /docs/reference/schedule/examples.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: examples 3 | title: "Examples" 4 | --- 5 | 6 | ```scala mdoc:invisible 7 | import zio._ 8 | ``` 9 | 10 | Let's try some example of creating and combining schedules. 11 | 12 | 1. Stop retrying after a specified amount of time has elapsed: 13 | 14 | ```scala mdoc:silent 15 | val expMaxElapsed = (Schedule.exponential(10.milliseconds) >>> Schedule.elapsed).whileOutput(_ < 30.seconds) 16 | ``` 17 | 18 | 2. Retry only when a specific exception occurs: 19 | 20 | ```scala mdoc:silent 21 | import scala.concurrent.TimeoutException 22 | 23 | val whileTimeout = Schedule.exponential(10.milliseconds) && Schedule.recurWhile[Throwable] { 24 | case _: TimeoutException => true 25 | case _ => false 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/state-management/fiber-local-state.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fiber-local-state 3 | title: "Fiber-local State" 4 | --- 5 | 6 | Both the `FiberRef` and `ZState` data types are state management tools that are scoped to a certain fiber. Their values are only accessible within the fiber that runs them. 7 | 8 | We have a separate page for the [`FiberRef`](fiberref.md) and [`ZState`](zstate.md) data types which explain how to use them. 9 | -------------------------------------------------------------------------------- /docs/reference/stm/thub.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: thub 3 | title: "THub" 4 | --- 5 | 6 | A `THub` is a transactional message hub. Publishers can publish messages to the hub and subscribers can subscribe to take messages from the hub. 7 | 8 | A `THub` is an asynchronous message hub like `Hub` but it can participate in STM transactions. APIs are almost identical, but they are in the `STM` world rather than the `ZIO` world. 9 | 10 | The fundamental operators on a `THub` are `publish` and `subscribe`: 11 | 12 | ```scala 13 | trait THub[A] { 14 | def publish(a: A): USTM[Boolean] 15 | def subscribe: USTM[TDequeue[B]] 16 | } 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/reference/stream/installation.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: installation 3 | title: "Installing ZIO Streams" 4 | sidebar_label: "Installation" 5 | --- 6 | 7 | In order to use ZIO Streaming, we need to add the required configuration in our SBT settings: 8 | 9 | ```scala mdoc:passthrough 10 | println(s"""```scala""") 11 | println( 12 | s"""libraryDependencies += Seq( 13 | "dev.zio" %% "zio" % "${zio.BuildInfo.version.split('+').head}" % Test 14 | "dev.zio" %% "zio-streams" % "${zio.BuildInfo.version.split('+').head}" % Test 15 | )""" 16 | ) 17 | println(s"""```""") 18 | ``` 19 | -------------------------------------------------------------------------------- /docs/reference/stream/zchannel/running-a-channel.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: running-a-channel 3 | title: "Running a Channel" 4 | --- 5 | 6 | To run a channel, we can use the `ZChannel.runXYZ` methods: 7 | 8 | - `ZChannel#run`— The `run` method is the simplest way to run a channel. It only runs a channel that doesn't read any input or write any output. 9 | - `ZChannel#runCollect`— It will run a channel and collects the output and finally returns it along with the done value of the channel. 10 | - `ZChannel#runDrain`— It will run a channel and ignore any emitted output. 11 | - `ZChannel#runScoped`— Using this method, we can run a channel in a scope. So all the finalizers of the scope will be run before the channel is closed. 12 | -------------------------------------------------------------------------------- /docs/reference/stream/zstream/scheduling.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: scheduling 3 | title: "Scheduling" 4 | --- 5 | 6 | To schedule the output of a stream we use `ZStream#schedule` combinator. 7 | 8 | Let's space between each emission of the given stream: 9 | 10 | ```scala mdoc:silent:nest 11 | import zio._ 12 | import zio.stream._ 13 | 14 | val stream = ZStream(1, 2, 3, 4, 5).schedule(Schedule.spaced(1.second)) 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/stream/zstream/type-aliases.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: type-aliases 3 | title: "Type Aliases" 4 | --- 5 | 6 | The `ZStream` data type, has two type aliases: 7 | 8 | ```scala 9 | type Stream[+E, +A] = ZStream[Any, E, A] 10 | type UStream[+A] = ZStream[Any, Nothing, A] 11 | ``` 12 | 13 | 1. `Stream[E, A]` is a type alias for `ZStream[Any, E, A]`, which represents a ZIO stream that does not require any services, and may fail with an `E`, or produce elements with an `A`. 14 | 15 | 2. `UStream[A]` is a type alias for `ZStream[Any, Nothing, A]`, which represents a ZIO stream that does not require any services, it cannot fail, and after evaluation, it may emit zero or more values of type `A`. 16 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/conditional-aspects.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: conditional 3 | title: "Conditional Aspects" 4 | --- 5 | 6 | When we apply a conditional aspect, it will run the spec only if the specified predicate is satisfied. 7 | 8 | - **`ifEnv`** — Only runs a test if the specified environment variable satisfies the specified assertion. 9 | - **`ifEnvSet`** — Only runs a test if the specified environment variable is set. 10 | - **`ifProp`** — Only runs a test if the specified Java property satisfies the specified assertion. 11 | - **`ifPropSet`** — Only runs a test if the specified Java property is set. 12 | 13 | ```scala mdoc:compile-only 14 | import zio._ 15 | import zio.test.{test, _} 16 | import zio.test.TestAspect._ 17 | 18 | test("a test that will run if the product is deployed in the testing environment") { 19 | ??? 20 | } @@ ifEnv("ENV")(_ == "testing") 21 | 22 | test("a test that will run if the java.io.tmpdir property is available") { 23 | ??? 24 | } @@ ifEnvSet("java.io.tmpdir") 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/debugging-and-diagnostics.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: debugging-and-diagnostics 3 | title: "Debugging and Diagnostics" 4 | --- 5 | 6 | 7 | ## Debugging 8 | The `TestConsole` service has two modes debug and silent state. ZIO Test has two corresponding test aspects to switch the debug state on and off: 9 | 10 | 1. `TestAspect.debug` — When the `TestConsole` is in the debug state, the console output is rendered to the standard output in addition to being written to the output buffer. We can manually enable this mode by using `TestAspect.debug` test aspect. 11 | 12 | 2. `TestAspect.silent` — This test aspect turns off the debug mode and turns on the silent mode. So the console output is only written to the output buffer and not rendered to the standard output. 13 | 14 | ## Diagnostics 15 | 16 | The `diagnose` is an aspect that runs each test on a separate fiber and prints a fiber dump if the test fails or has not terminated within the specified duration. 17 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/flaky-and-non-flaky-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: flaky-and-non-flaky-tests 3 | title: "Flaky and Non-flaky Tests" 4 | --- 5 | 6 | Whenever we deal with concurrency issues or race conditions, we should ensure that our tests pass consistently. The `nonFlaky` is a test aspect to do that. 7 | 8 | It will run a test several times, by default 100 times, and if all those times pass, it will pass, otherwise, it will fail: 9 | 10 | ```scala mdoc:compile-only 11 | import zio._ 12 | import zio.test.{test, _} 13 | import zio.test.TestAspect._ 14 | 15 | test("random value is always greater than zero") { 16 | for { 17 | random <- Random.nextIntBounded(100) 18 | } yield assertTrue(random > 0) 19 | } @@ nonFlaky 20 | ``` 21 | 22 | Additionally, there is a `TestAspect.flaky` test aspect which retries a test until it succeeds. 23 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/ignoring-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: ignoring-tests 3 | title: "Ignoring Tests" 4 | --- 5 | 6 | To ignore running a test, we can use the `ignore` test aspect: 7 | 8 | ```scala mdoc:compile-only 9 | import zio._ 10 | import zio.test.{test, _} 11 | 12 | test("an ignored test") { 13 | assertTrue(false) 14 | } @@ TestAspect.ignore 15 | ``` 16 | 17 | To fail all ignored tests, we can use the `success` test aspect: 18 | 19 | ```scala mdoc:compile-only 20 | import zio._ 21 | import zio.test.{test, _} 22 | 23 | suite("sample tests")( 24 | test("an ignored test") { 25 | assertTrue(false) 26 | } @@ TestAspect.ignore, 27 | test("another ignored test") { 28 | assertTrue(true) 29 | } @@ TestAspect.ignore 30 | ) @@ TestAspect.success 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/sized.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: sized 3 | title: "Changing the Size of Sized Generators" 4 | --- 5 | 6 | To change the default _size_ used by [sized generators](../property-testing/built-in-generators.md#sized-generators) we can use `size` test aspect: 7 | 8 | ```scala mdoc:compile-only 9 | import zio._ 10 | import zio.test.{ test, _ } 11 | 12 | test("generating small list of characters") { 13 | check(Gen.small(Gen.listOfN(_)(Gen.alphaNumericChar))) { n => 14 | ZIO.attempt(n).debug *> Sized.size.map(s => assertTrue(s == 50)) 15 | } 16 | } @@ TestAspect.size(50) @@ TestAspect.samples(5) 17 | ``` 18 | 19 | Sample output: 20 | 21 | ``` 22 | List(p, M) 23 | List() 24 | List(0, m, 5) 25 | List(Y) 26 | List(O, b, B, V) 27 | + generating small list of characters 28 | Ran 1 test in 676 ms: 1 succeeded, 0 ignored, 0 failed 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/reference/test/aspects/timing-out-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: timing-out-tests 3 | title: "Timing-out Tests" 4 | --- 5 | 6 | The `timeout` test aspect takes a duration and times out each test. If the test case runs longer than the time specified, it is immediately canceled and reported as a failure, with a message showing that the timeout was exceeded: 7 | 8 | ```scala mdoc:compile-only 9 | import zio._ 10 | import zio.test.{test, _} 11 | 12 | test("effects can be safely interrupted") { 13 | for { 14 | _ <- ZIO.attempt(println("Still going ...")).forever 15 | } yield assertTrue(true) 16 | } @@ TestAspect.timeout(1.second) 17 | ``` 18 | 19 | By applying a `timeout(1.second)` test aspect, this will work with ZIO's interruption mechanism. So when we run this test, you can see a tone of print lines, and after a second, the `timeout` aspect will interrupt that. 20 | -------------------------------------------------------------------------------- /docs/reference/test/services/test-config.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: config 3 | title: "TestConfig" 4 | --- 5 | 6 | The `TestConfig` service provides access to default configuration settings used by ZIO Test: 7 | 8 | 1. Repeats — The number of times to repeat tests to ensure they are stable. 9 | 2. Retries — The number of times to retry flaky tests. 10 | 3. Samples — The number of sufficient samples to check for a random variable. 11 | 4. Shrinks — The maximum number of [shrinkings](../property-testing/shrinking.md) to minimize large failures. 12 | 13 | Currently, the live version of `TestEnvironment` contains the live version of this service with the following configs: 14 | 15 | ```scala 16 | TestConfig.live( 17 | repeats0 = 100, 18 | retries0 = 100, 19 | samples0 = 200, 20 | shrinks0 = 1000 21 | ) 22 | ``` 23 | 24 | So by default, the ZIO Test runner will run tests with this config. Regular users do not need access to this service unless they need to change or access configurations from the ZIO Test environment. 25 | -------------------------------------------------------------------------------- /docs/resources/cheatsheets.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cheatsheets 3 | title: "Cheat Sheets" 4 | --- 5 | 6 | - [ZIO Cheat Sheet](https://github.com/ghostdogpr/zio-cheatsheet) 7 | - [Snippets for Future/Scalaz Task](https://gist.github.com/ubourdon/7b7e929117343b2324cde6eab57674a6) 8 | -------------------------------------------------------------------------------- /docs/resources/cookbooks.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cookbooks 3 | title: "Cookbooks" 4 | --- 5 | 6 | - [ZIO Cookbook](https://github.com/Neurodyne/zio-cookbook) A beginners' tour to ZIO by Boris V.Kuznetsov 7 | - [Mastering modularity in ZIO with ZLayers](https://scalac.io/ebook/mastering-modularity-in-zio-with-zlayer/intro/) by Jorge Vasquez 8 | - [Improve your focus with ZIO Optics](https://scalac.io/ebook/improve-your-focus-with-zio-optics/introduction-5/) by Jorge Vasquez 9 | -------------------------------------------------------------------------------- /docs/resources/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Summary" 4 | --- 5 | 6 | ZIO has a huge ecosystem of libraries, tools, talks, tutorials, and more. In this section, we are going to introduce some of the most important ones. 7 | 8 | :::info 9 | If you find a new great library, talk, resource, slides, or project, related to ZIO, consider adding it to the list with your PR. 10 | ::: 11 | -------------------------------------------------------------------------------- /docs/resources/projectsusingzio.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: poweredbyzio 3 | title: "Projects using ZIO" 4 | --- 5 | 6 | - [Rudder](https://github.com/normation/rudder) — an example about how to manage error ADT in several sub-projects and specialized sub-domains, and how one can gradually contextualize error messages in domain layers. Uses queues, resources, interop with Java, and historical code. See [context and references](https://issues.rudder.io/issues/14870). 7 | - [ZIO AI Platform Backend](https://github.com/Clover-Group/zio_front) — Clover Group AI Platform backend, which employs ZIO, Doobie, http4s and Kafka . 8 | - [Polynote](https://github.com/polynote/polynote) — a new, polyglot notebook with first-class Scala support, Apache Spark integration, multi-language interoperability including Scala, Python, and SQL, as-you-type autocomplete, and more. 9 | - [Blended ZIO](https://blended-zio.github.io/blended-zio/) — A sample project migrating a largely untyped, actor based integration framework to ZIO. 10 | -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/resources/application.conf: -------------------------------------------------------------------------------- 1 | UserApp { 2 | dataSourceClassName = org.h2.jdbcx.JdbcDataSource 3 | dataSource { 4 | url = "jdbc:h2:file:./userapp;DB_CLOSE_DELAY=-1;INIT=RUNSCRIPT FROM 'classpath:h2-schema.sql'" 5 | user = sa 6 | } 7 | } 8 | 9 | HttpServerConfig { 10 | # The port to listen on. 11 | port = 8080 12 | port = ${?PORT} 13 | 14 | # The hostname to listen on. 15 | host = "localhost" 16 | host = ${?HOST} 17 | 18 | nThreads = 0 19 | nThreads = ${?NTHREADS} 20 | } 21 | -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/resources/bigfile.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | 11 12 | 12 13 | 13 14 | 14 15 | 15 16 | 16 17 | 17 18 | 18 19 | 19 20 | 20 21 | 21 22 | 22 23 | 23 24 | 24 25 | 25 26 | 26 27 | 27 28 | 28 29 | 29 30 | 30 31 | 31 32 | 32 33 | 33 34 | 34 35 | 35 36 | 36 37 | 37 38 | 38 39 | 39 40 | 40 41 | 41 42 | 42 43 | 43 44 | 44 45 | 45 46 | 46 47 | 47 48 | 48 49 | 49 50 | 50 51 | 51 52 | 52 53 | 53 54 | 54 55 | 55 56 | 56 57 | 57 58 | 58 59 | 59 60 | 60 61 | 61 62 | 62 63 | 63 64 | 64 65 | 65 66 | 66 67 | 67 68 | 68 69 | 69 70 | 70 71 | 71 72 | 72 73 | 73 74 | 74 75 | 75 76 | 76 77 | 77 78 | 78 79 | 79 80 | 80 81 | 81 82 | 82 83 | 83 84 | 84 85 | 85 86 | 86 87 | 87 88 | 88 89 | 89 90 | 90 91 | 91 92 | 92 93 | 93 94 | 94 95 | 95 96 | 96 97 | 97 98 | 98 99 | 99 100 | 100 -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/resources/file.txt: -------------------------------------------------------------------------------- 1 | line number 1 2 | 1, 2, 3, 4, 5 3 | line number 3 4 | end of file -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/resources/h2-schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS "UserTable"( 2 | "uuid" uuid NOT NULL PRIMARY KEY, 3 | "name" VARCHAR(255), 4 | "age" int 5 | ); -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/scala/dev/zio/quickstart/config/HttpServerConfig.scala: -------------------------------------------------------------------------------- 1 | package dev.zio.quickstart.config 2 | 3 | import zio.Config 4 | import zio.config.magnolia._ 5 | 6 | case class HttpServerConfig(host: String, port: Int, nThreads: Int) 7 | 8 | object HttpServerConfig { 9 | // Automatic Config Derivation 10 | // Import zio.config.magnolia for automatic derivation 11 | val config: Config[HttpServerConfig] = 12 | deriveConfig[HttpServerConfig].nested("HttpServerConfig") 13 | 14 | // Manual Config Derivation 15 | val config_manual: Config[HttpServerConfig] = 16 | (Config.int.nested("port") ++ 17 | Config.string.nested("host") ++ 18 | Config.int.nested("nThreads")) 19 | .map { case (port, host, nThreads) => 20 | HttpServerConfig(host, port, nThreads) 21 | } 22 | .nested("HttpServerConfig") 23 | } 24 | -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/scala/dev/zio/quickstart/users/InmemoryUserRepo.scala: -------------------------------------------------------------------------------- 1 | package dev.zio.quickstart.users 2 | 3 | import zio._ 4 | 5 | import scala.collection.mutable 6 | 7 | case class InmemoryUserRepo(map: Ref[mutable.Map[String, User]]) 8 | extends UserRepo { 9 | def register(user: User): UIO[String] = 10 | for { 11 | id <- Random.nextUUID.map(_.toString) 12 | _ <- map.updateAndGet(_ addOne (id, user)) 13 | } yield id 14 | 15 | def lookup(id: String): UIO[Option[User]] = 16 | map.get.map(_.get(id)) 17 | 18 | def users: UIO[List[User]] = 19 | map.get.map(_.values.toList) 20 | } 21 | 22 | object InmemoryUserRepo { 23 | def layer: ZLayer[Any, Nothing, InmemoryUserRepo] = 24 | ZLayer.fromZIO( 25 | Ref.make(mutable.Map.empty[String, User]).map(new InmemoryUserRepo(_)) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/scala/dev/zio/quickstart/users/User.scala: -------------------------------------------------------------------------------- 1 | package dev.zio.quickstart.users 2 | 3 | import zio.schema.{DeriveSchema, Schema} 4 | 5 | case class User(name: String, age: Int) 6 | 7 | object User { 8 | implicit val schema: Schema[User] = 9 | DeriveSchema.gen[User] 10 | } 11 | -------------------------------------------------------------------------------- /documentation/guides/tutorials/make-a-zio-app-configurable/src/main/scala/dev/zio/quickstart/users/UserRepo.scala: -------------------------------------------------------------------------------- 1 | package dev.zio.quickstart.users 2 | 3 | import zio._ 4 | 5 | trait UserRepo { 6 | def register(user: User): Task[String] 7 | 8 | def lookup(id: String): Task[Option[User]] 9 | 10 | def users: Task[List[User]] 11 | } 12 | 13 | object UserRepo { 14 | def register(user: User): ZIO[UserRepo, Throwable, String] = 15 | ZIO.serviceWithZIO[UserRepo](_.register(user)) 16 | 17 | def lookup(id: String): ZIO[UserRepo, Throwable, Option[User]] = 18 | ZIO.serviceWithZIO[UserRepo](_.lookup(id)) 19 | 20 | def users: ZIO[UserRepo, Throwable, List[User]] = 21 | ZIO.serviceWithZIO[UserRepo](_.users) 22 | } 23 | -------------------------------------------------------------------------------- /examples/jvm/src/test/scala/zio/examples/test/ExampleSpecWithJUnit.scala: -------------------------------------------------------------------------------- 1 | package zio.examples.test 2 | 3 | import zio.test._ 4 | import zio.test.junit.JUnitRunnableSpec 5 | 6 | class ExampleSpecWithJUnit extends JUnitRunnableSpec { 7 | 8 | def spec = suite("some suite")( 9 | test("failing test") { 10 | assert(1)(Assertion.equalTo(2)) 11 | }, 12 | test("passing test") { 13 | assert(1)(Assertion.equalTo(1)) 14 | }, 15 | test("failing test assertTrue") { 16 | val one = 1 17 | assertTrue(one == 2) 18 | }, 19 | test("passing test assertTrue") { 20 | assertTrue(1 == 1) 21 | } 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /examples/shared/src/main/scala/zio/examples/RealWorldProvideExample.scala: -------------------------------------------------------------------------------- 1 | package zio.examples 2 | 3 | object RealWorldProvideExample {} 4 | -------------------------------------------------------------------------------- /examples/shared/src/main/scala/zio/examples/ZLayerInjectExample.scala: -------------------------------------------------------------------------------- 1 | package zio.examples 2 | 3 | import zio.examples.types._ 4 | import zio._ 5 | 6 | import java.io.IOException 7 | 8 | object ZLayerInjectExample extends ZIOAppDefault { 9 | val program: ZIO[OldLady, IOException, Unit] = 10 | OldLady.contentsOfStomach.flatMap { contents => 11 | Console.printLine(s"There was an old who lady swallowed:\n- ${contents.mkString("\n- ")}") 12 | } 13 | 14 | val thing: ULayer[Int] = ZLayer.succeed(12) 15 | 16 | val autoLayer: ZLayer[Any, Nothing, OldLady] = 17 | ZLayer.make[OldLady]( 18 | OldLady.live, 19 | Spider.live, 20 | Fly.live, 21 | Bear.live 22 | ) 23 | 24 | def run = 25 | program.provide(OldLady.live, Spider.live, Fly.live, Bear.live) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /examples/shared/src/test/scala/zio/examples/test/ExampleSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.examples.test 2 | 3 | import zio.test._ 4 | 5 | object ExampleSpec extends ZIOSpecDefault { 6 | 7 | def spec = suite("some suite")( 8 | test("failing test") { 9 | val stuff = 1 10 | assert(stuff)(Assertion.equalTo(2)) 11 | }, 12 | test("failing test 2") { 13 | val stuff = Some(1) 14 | assert(stuff)(Assertion.isSome(Assertion.equalTo(2))) 15 | }, 16 | test("failing test 3") { 17 | val stuff = Some(1) 18 | assert(stuff)(Assertion.isSome(Assertion.not(Assertion.equalTo(1)))) 19 | }, 20 | test("passing test") { 21 | assert(1)(Assertion.equalTo(1)) 22 | } 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /macros-tests/src/test/scala-2/scala/annotation/experimental.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package scala 18 | package annotation 19 | 20 | /** 21 | * For Scala 3 compatibility 22 | */ 23 | class experimental extends StaticAnnotation 24 | -------------------------------------------------------------------------------- /macros/src/main/scala-2/zio/macros/throwing.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.macros 18 | 19 | import scala.annotation.StaticAnnotation 20 | 21 | class throwing extends StaticAnnotation 22 | -------------------------------------------------------------------------------- /macros/src/main/scala/zio/macros/package.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | package object macros { 4 | 5 | implicit final class ReloadableSyntax[Service](private val layer: ZLayer[Any, Any, Service]) extends AnyVal { 6 | 7 | /** 8 | * Returns a layer that constructs a version of the service output by this 9 | * layer that can be dynamically reloaded with `ServiceReloader.reload`. 10 | */ 11 | def reloadable(implicit 12 | tag: Tag[Service], 13 | isReloadable: IsReloadable[Service], 14 | trace: Trace 15 | ): ZLayer[ServiceReloader, ServiceReloader.Error, Service] = 16 | ZLayer.fromZIO(ServiceReloader.register(layer)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /managed/js/src/main/scala/zio/managed/ZManagedPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.managed 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[managed] trait ZManagedPlatformSpecific 22 | -------------------------------------------------------------------------------- /managed/native/src/main/scala/zio/managed/ZManagedPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.managed 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[managed] trait ZManagedPlatformSpecific 22 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.11.3 2 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended", 4 | ":disableDependencyDashboard" 5 | ], 6 | "includePaths": [ 7 | "website/package.json" 8 | ], 9 | "enabledManagers": [ 10 | "npm" 11 | ], 12 | "branchPrefix": "renovate/", 13 | "automergeType": "pr", 14 | "automerge": true, 15 | "platformAutomerge": true, 16 | "packageRules": [ 17 | { 18 | "description": "Update Official ZIO Ecosystem Docs", 19 | "matchBaseBranches": [ 20 | "series/2.x" 21 | ], 22 | "labels": [ 23 | "dependencies", 24 | "documentation" 25 | ], 26 | "enabled": true, 27 | "matchPackageNames": [ 28 | "@zio.dev{/,}**" 29 | ] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/AbstractRunnableSpecToZioSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.test._ 7 | 8 | class AbstractRunnableSpecToZioSpec { 9 | object HasSpec extends DefaultRunnableSpec { 10 | override def spec: ZSpec[Environment, Failure] = ??? 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/BlockingUses.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.blocking.effectBlockingIO 7 | import zio.blocking._ 8 | import zio.blocking.Blocking 9 | 10 | object BlockingUses { 11 | val x = Blocking.Service 12 | } 13 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/LatchOps.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package zio 5 | 6 | trait LatchOps { 7 | def withLatch[R, E, A](f: UIO[Unit] => ZIO[R, E, A]): ZIO[R, E, A] = 8 | Promise.make[Nothing, Unit] >>= (latch => f(latch.succeed(()).unit) <* latch.await) 9 | 10 | def withLatch[R, E, A](f: (UIO[Unit], UIO[Unit]) => ZIO[R, E, A]): ZIO[R, E, A] = 11 | for { 12 | ref <- Ref.make(true) 13 | latch <- Promise.make[Nothing, Unit] 14 | a <- f(latch.succeed(()).unit, ZIO.uninterruptibleMask(restore => ref.set(false) *> restore(latch.await))) 15 | _ <- UIO.whenM(ref.get)(latch.await) 16 | } yield a 17 | } 18 | 19 | object LatchOps extends LatchOps 20 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/RandomService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.random.Random 7 | import zio._ 8 | 9 | object RandomService { 10 | val random: URIO[Has[Random.Service], Random.Service] = ZIO.service[Random.Service] 11 | } -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/ScheduleRenames.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.Schedule.once 7 | 8 | @annotation.nowarn("msg=pure expression does nothing") 9 | object ScheduleRenames { 10 | once.addDelayM _ 11 | once.checkM _ 12 | once.contramapM _ 13 | once.delayedM _ 14 | once.dimapM _ 15 | once.foldM _ 16 | once.mapM _ 17 | once.modifyDelayM _ 18 | once.reconsiderM _ 19 | once.untilInputM _ 20 | once.untilOutputM _ 21 | once.whileInputM _ 22 | once.whileOutputM _ 23 | } 24 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/SimpleApp.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.App 7 | 8 | trait SimpleApp extends App {} 9 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/ZLayerPieces.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.ZLayer 7 | 8 | object ZLayerPieces { 9 | ZLayer.requires[Int] 10 | ZLayer.identity[Int] 11 | } 12 | -------------------------------------------------------------------------------- /scalafix/input/src/main/scala/fix/ZSTMRenames.scala: -------------------------------------------------------------------------------- 1 | /* 2 | rule = Zio2Upgrade 3 | */ 4 | package fix 5 | 6 | import zio.stm.ZSTM 7 | 8 | @annotation.nowarn("msg=pure expression does nothing") 9 | object ZSTMRenames { 10 | ZSTM.collectAll_ _ 11 | ZSTM.foreach_ _ 12 | ZSTM.fromFunction _ 13 | ZSTM.fromFunctionM _ 14 | ZSTM.ifM _ 15 | ZSTM.loop_ _ 16 | ZSTM.partial _ 17 | ZSTM.replicateM _ 18 | ZSTM.replicateM_ _ 19 | ZSTM.unlessM _ 20 | ZSTM.whenCaseM _ 21 | ZSTM.whenM _ 22 | } 23 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/AbstractRunnableSpecToZioSpec.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio.test._ 4 | import zio.test.ZIOSpecDefault 5 | 6 | class AbstractRunnableSpecToZioSpec { 7 | object HasSpec extends ZIOSpecDefault { 8 | override def spec = ??? 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/BlockingUses.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | 4 | 5 | 6 | object BlockingUses { 7 | val x = Blocking.Service 8 | } 9 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/LatchOps.scala: -------------------------------------------------------------------------------- 1 | package zio 2 | 3 | trait LatchOps { 4 | def withLatch[R, E, A](f: UIO[Unit] => ZIO[R, E, A]): ZIO[R, E, A] = 5 | Promise.make[Nothing, Unit] flatMap (latch => f(latch.succeed(()).unit) <* latch.await) 6 | 7 | def withLatch[R, E, A](f: (UIO[Unit], UIO[Unit]) => ZIO[R, E, A]): ZIO[R, E, A] = 8 | for { 9 | ref <- Ref.make(true) 10 | latch <- Promise.make[Nothing, Unit] 11 | a <- f(latch.succeed(()).unit, ZIO.uninterruptibleMask(restore => ref.set(false) *> restore(latch.await))) 12 | _ <- ZIO.whenZIO(ref.get)(latch.await) 13 | } yield a 14 | } 15 | 16 | object LatchOps extends LatchOps 17 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/RandomService.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio._ 4 | import zio.Random 5 | 6 | object RandomService { 7 | val random: URIO[Random, Random] = ZIO.service[Random] 8 | } -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/ScheduleRenames.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio.Schedule.once 4 | 5 | object ScheduleRenames { 6 | once.addDelayZIO _ 7 | once.checkZIO _ 8 | once.contramapZIO _ 9 | once.delayedZIO _ 10 | once.dimapZIO _ 11 | once.foldZIO _ 12 | once.mapZIO _ 13 | once.modifyDelayZIO _ 14 | once.reconsiderZIO _ 15 | once.untilInputZIO _ 16 | once.untilOutputZIO _ 17 | once.whileInputZIO _ 18 | once.whileOutputZIO _ 19 | } 20 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/SimpleApp.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio.ZIOAppDefault 4 | 5 | trait SimpleApp extends ZIOAppDefault {} 6 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/ZLayerPieces.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio.ZLayer 4 | 5 | object ZLayerPieces { 6 | ZLayer.service[Int] 7 | ZLayer.service[Int] 8 | } 9 | -------------------------------------------------------------------------------- /scalafix/output/src/main/scala/fix/ZSTMRenames.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import zio.stm.ZSTM 4 | 5 | object ZSTMRenames { 6 | ZSTM.collectAllDiscard _ 7 | ZSTM.foreachDiscard _ 8 | ZSTM.environmentWith _ 9 | ZSTM.environmentWithSTM _ 10 | ZSTM.ifSTM _ 11 | ZSTM.loopDiscard _ 12 | ZSTM.attempt _ 13 | ZSTM.replicateSTM _ 14 | ZSTM.replicateSTMDiscard _ 15 | ZSTM.unlessSTM _ 16 | ZSTM.whenCaseSTM _ 17 | ZSTM.whenSTM _ 18 | } 19 | -------------------------------------------------------------------------------- /scalafix/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.8.0 2 | -------------------------------------------------------------------------------- /scalafix/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.13.0") 2 | -------------------------------------------------------------------------------- /scalafix/readme.md: -------------------------------------------------------------------------------- 1 | # Scalafix rules for zio 2 | 3 | To develop rule: 4 | ``` 5 | sbt ~tests/test 6 | # edit rules/src/main/scala/fix/CurriedAssert.scala 7 | ``` 8 | -------------------------------------------------------------------------------- /scalafix/rules/src/main/resources/META-INF/services/scalafix.v1.Rule: -------------------------------------------------------------------------------- 1 | fix.CurriedAssert 2 | fix.Zio2Upgrade -------------------------------------------------------------------------------- /scalafix/rules/src/main/scala/fix/CurriedAssert.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import scalafix.v1._ 4 | import scala.meta._ 5 | 6 | class CurriedAssert extends SemanticRule("CurriedAssert") { 7 | 8 | val assert = SymbolMatcher.normalized( 9 | "zio.test.package.assert", 10 | "zio.test.package.assertM" 11 | ) 12 | 13 | override def fix(implicit doc: SemanticDocument): Patch = 14 | doc.tree.collect { 15 | case t @ assert(Term.Apply.After_4_6_0(name, argClause)) if argClause.values.size == 2 => 16 | val (value, assertion) = (argClause.values: @unchecked) match { 17 | case List(value, assertion) => (value, assertion) 18 | } 19 | Patch.replaceTree(t, name.toString + "(" + value + ")(" + assertion + ")") 20 | case _ => 21 | Patch.empty 22 | }.asPatch 23 | } 24 | -------------------------------------------------------------------------------- /scalafix/tests/src/test/scala/fix/RuleSuite.scala: -------------------------------------------------------------------------------- 1 | package fix 2 | 3 | import scalafix.testkit._ 4 | import org.scalatest.funsuite.AnyFunSuiteLike 5 | 6 | class RuleSuite extends AbstractSemanticRuleSuite with AnyFunSuiteLike { 7 | runAllTests() 8 | } 9 | -------------------------------------------------------------------------------- /stacktracer/src/main/scala-2/zio/internal/stacktracer/SourceLocation.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.internal.stacktracer 18 | 19 | final case class SourceLocation(path: String, line: Int) 20 | object SourceLocation { 21 | implicit def sourceLocation: SourceLocation = macro Macros.sourceLocation 22 | } 23 | -------------------------------------------------------------------------------- /stacktracer/src/main/scala/zio/internal/stacktracer/ParsedTrace.scala: -------------------------------------------------------------------------------- 1 | package zio.internal.stacktracer 2 | 3 | private[zio] final case class ParsedTrace( 4 | location: String, 5 | file: String, 6 | line: Int 7 | ) 8 | -------------------------------------------------------------------------------- /stacktracer/src/main/scala/zio/stacktracer/TracingImplicits.scala: -------------------------------------------------------------------------------- 1 | package zio.stacktracer 2 | 3 | object TracingImplicits { 4 | 5 | implicit val disableAutoTrace: DisableAutoTrace = new DisableAutoTrace {} 6 | } 7 | 8 | sealed trait DisableAutoTrace 9 | -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16BE-no-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16BE-no-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16BE-with-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16BE-with-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16LE-no-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16LE-no-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16LE-with-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-16LE-with-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32BE-no-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32BE-no-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32BE-with-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32BE-with-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32LE-no-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32LE-no-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32LE-with-BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-UTF-32LE-with-BOM.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-modified-Windows-1252.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/bom/quickbrown-modified-Windows-1252.txt -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/compression/hello.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /streams-tests/jvm/src/test/resources/zio/stream/compression/hello.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/streams-tests/jvm/src/test/resources/zio/stream/compression/hello.txt.gz -------------------------------------------------------------------------------- /streams-tests/shared/src/test/scala/StreamREPLSpec.scala: -------------------------------------------------------------------------------- 1 | import zio.test._ 2 | 3 | import scala.annotation.nowarn 4 | 5 | object StreamREPLSpec extends ZIOSpecDefault { 6 | 7 | def spec = suite("StreamREPLSpec")( 8 | test("settings compile") { 9 | import zio._ 10 | @nowarn("msg=never used") 11 | implicit class RunSyntax[A](io: ZIO[Any, Any, A]) { 12 | def unsafeRun: A = 13 | Unsafe.unsafe { implicit unsafe => 14 | Runtime.default.unsafe.run(io).getOrThrowFiberFailure() 15 | } 16 | } 17 | assertCompletes 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /streams/shared/src/main/scala-3/zio.stream/ZStreamVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio.stream 2 | 3 | import zio.ZLayer 4 | import zio.internal.macros.LayerMacros 5 | 6 | private[stream] trait ZStreamVersionSpecific[-R, +E, +O] { self: ZStream[R, E, O] => 7 | 8 | /** 9 | * Automatically assembles a layer for the ZStream effect, which translates it 10 | * to another level. 11 | */ 12 | inline def provide[E1 >: E](inline layer: ZLayer[_, E1, _]*): ZStream[Any, E1, O] = 13 | ${ ZStreamProvideMacro.provideImpl[Any, R, E1, O]('self, 'layer) } 14 | 15 | } 16 | 17 | private[stream] object ZStreamProvideMacro { 18 | import scala.quoted._ 19 | 20 | def provideImpl[R0: Type, R: Type, E: Type, A: Type]( 21 | zstream: Expr[ZStream[R, E, A]], 22 | layer: Expr[Seq[ZLayer[_, E, _]]] 23 | )(using Quotes): Expr[ZStream[R0, E, A]] = { 24 | val layerExpr = LayerMacros.constructStaticProvideLayer[R0, R, E](layer) 25 | '{ $zstream.provideLayer($layerExpr.asInstanceOf[ZLayer[R0, E, R]]) } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /streams/shared/src/main/scala/zio/stream/internal/CharacterSet.scala: -------------------------------------------------------------------------------- 1 | package zio.stream.internal 2 | 3 | import zio.Chunk 4 | 5 | import java.nio.charset.Charset 6 | 7 | private[zio] object CharacterSet { 8 | 9 | val CharsetUtf32: Charset = Charset.forName("UTF-32") 10 | val CharsetUtf32BE: Charset = Charset.forName("UTF-32BE") 11 | val CharsetUtf32LE: Charset = Charset.forName("UTF-32LE") 12 | 13 | object BOM { 14 | val Utf8: Chunk[Byte] = Chunk(-17, -69, -65) 15 | val Utf16BE: Chunk[Byte] = Chunk(-2, -1) 16 | val Utf16LE: Chunk[Byte] = Chunk(-1, -2) 17 | val Utf32BE: Chunk[Byte] = Chunk(0, 0, -2, -1) 18 | val Utf32LE: Chunk[Byte] = Chunk(-1, -2, 0, 0) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-junit-engine-tests/maven/settings.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4 | 5 | </settings> 6 | -------------------------------------------------------------------------------- /test-junit-engine-tests/maven/src/test/scala/zio/test/junit/maven/FailingSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test.junit.maven 2 | 3 | import zio.test.junit._ 4 | import zio.test._ 5 | import zio.test.Assertion._ 6 | 7 | object FailingSpec extends ZIOSpecDefault { 8 | override def spec = suite("FailingSpec")( 9 | test("should fail") { 10 | assert(11)(equalTo(12)) 11 | }, 12 | test("should fail - isSome") { 13 | assert(Some(11))(isSome(equalTo(12))) 14 | }, 15 | test("should succeed") { 16 | assert(12)(equalTo(12)) 17 | } 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /test-junit-engine-tests/maven/src/test/scala/zio/test/junit/maven/TaggedSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test.junit.maven 2 | 3 | import zio.test.junit._ 4 | import zio.test._ 5 | import zio.test.Assertion._ 6 | 7 | object TaggedSpec extends ZIOSpecDefault { 8 | override def spec = suite("TaggedSpec")( 9 | test("should run for tag tagged") { 10 | assert(12)(equalTo(12)) 11 | }, 12 | test("should run for tag a and tagged") { 13 | assert(12)(equalTo(12)) 14 | } @@ TestAspect.tag("a"), 15 | test("should run for tag b and tagged") { 16 | assert(12)(equalTo(12)) 17 | } @@ TestAspect.tag("b"), 18 | test("should run for tag a b tagged") { 19 | assert(12)(equalTo(12)) 20 | } @@ TestAspect.tag("a") @@ TestAspect.tag("b"), 21 | ) @@ TestAspect.tag("tagged") 22 | } 23 | -------------------------------------------------------------------------------- /test-junit-engine/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine: -------------------------------------------------------------------------------- 1 | zio.test.junit.ZIOTestEngine -------------------------------------------------------------------------------- /test-junit-engine/src/main/scala/zio/test/junit/ReflectionUtils.scala: -------------------------------------------------------------------------------- 1 | package zio.test.junit 2 | 3 | import scala.util.Try 4 | 5 | private[zio] object ReflectionUtils { 6 | 7 | /** 8 | * Retrieves the companion object of the specified class, if it exists. Here 9 | * we use plain java reflection as runtime reflection is not available for 10 | * scala 3 11 | * 12 | * @param klass 13 | * The class for which to retrieve the companion object. 14 | * @return 15 | * the optional companion object. 16 | */ 17 | def getCompanionObject(klass: Class[_]): Option[Any] = 18 | Try { 19 | (if (klass.getName.endsWith("quot;)) klass else getClass.getClassLoader.loadClass(klass.getName + "quot;)) 20 | .getDeclaredField("MODULEquot;) 21 | .get(null) 22 | }.toOption 23 | } 24 | -------------------------------------------------------------------------------- /test-junit-tests/maven/settings.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4 | 5 | </settings> 6 | -------------------------------------------------------------------------------- /test-junit-tests/maven/src/test/scala/zio/test/junit/maven/FailingSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test.junit.maven 2 | 3 | import zio.test.junit._ 4 | import zio.test._ 5 | import zio.test.Assertion._ 6 | 7 | class FailingSpec extends JUnitRunnableSpec { 8 | override def spec = suite("FailingSpec")( 9 | test("should fail") { 10 | assert(11)(equalTo(12)) 11 | }, 12 | test("should fail - isSome") { 13 | assert(Some(11))(isSome(equalTo(12))) 14 | }, 15 | test("should succeed") { 16 | assert(12)(equalTo(12)) 17 | } 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /test-magnolia/src/main/scala/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/test-magnolia/src/main/scala/.gitkeep -------------------------------------------------------------------------------- /test-refined/src/main/scala/zio/test/refined/types/CharInstances.scala: -------------------------------------------------------------------------------- 1 | package zio.test.refined.types 2 | 3 | import eu.timepit.refined.api.Refined 4 | import eu.timepit.refined.types.char._ 5 | import zio.test.Gen 6 | import zio.test.magnolia.DeriveGen 7 | object char extends CharInstances 8 | 9 | trait CharInstances { 10 | val lowerCaseCharGen: Gen[Any, LowerCaseChar] = Gen.alphaChar.map(v => Refined.unsafeApply(v.toLower)) 11 | val upperCaseCharGen: Gen[Any, UpperCaseChar] = Gen.alphaChar.map(v => Refined.unsafeApply(v.toUpper)) 12 | 13 | implicit val lowerCaseCharDeriveGen: DeriveGen[LowerCaseChar] = DeriveGen.instance(lowerCaseCharGen) 14 | implicit val upperCaseCharDeriveGen: DeriveGen[UpperCaseChar] = DeriveGen.instance(upperCaseCharGen) 15 | } 16 | -------------------------------------------------------------------------------- /test-refined/src/main/scala/zio/test/refined/types/all.scala: -------------------------------------------------------------------------------- 1 | package zio.test.refined.types 2 | 3 | object all extends AllTypesInstances 4 | 5 | trait AllTypesInstances 6 | extends CharInstances 7 | with DigitInstances 8 | with NetInstances 9 | with NumericInstances 10 | with StringInstance 11 | with TimeInstances 12 | -------------------------------------------------------------------------------- /test-sbt/jvm/src/test/scala/zio/test/sbt/TestMain.scala: -------------------------------------------------------------------------------- 1 | package zio.test.sbt 2 | 3 | object TestMain { 4 | def main(args: Array[String]): Unit = 5 | TestingSupport.run(ZTestFrameworkSbtSpec.tests: _*) 6 | } 7 | -------------------------------------------------------------------------------- /test-sbt/shared/src/main/scala/zio/test/sbt/ZioSpecFingerprint.scala: -------------------------------------------------------------------------------- 1 | package zio.test.sbt 2 | 3 | import sbt.testing.SubclassFingerprint 4 | import zio.test.ZIOSpecAbstract 5 | 6 | object ZioSpecFingerprint extends SubclassFingerprint { 7 | def superclassName(): String = classOf[ZIOSpecAbstract].getName 8 | final def isModule() = true 9 | final def requireNoArgConstructor() = false 10 | } 11 | -------------------------------------------------------------------------------- /test-scalacheck/src/test/scala/zio/test/scalacheck/AssertionSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test.scalacheck 2 | 3 | import org.scalacheck.{Prop, Properties} 4 | import zio.Scope 5 | import zio.test._ 6 | 7 | object AssertionSpec extends ZIOSpecDefault { 8 | object FailingProperties extends Properties("MyProperties") { 9 | property("PassingProp") = Prop.propBoolean(false) 10 | } 11 | 12 | object PassingProperties extends Properties("MyProperties") { 13 | property("FailingProp") = Prop.propBoolean(true) 14 | } 15 | 16 | override def spec: Spec[TestEnvironment with Scope, Any] = 17 | suite("ZIO assertions for ScalaCheck")( 18 | test("Prop passing")(Prop.propBoolean(true).assertZIO()), 19 | test("Prop failing")(Prop.propBoolean(false).assertZIO()) @@ TestAspect.failing, 20 | test("Properties passing")(PassingProperties.assertZIO()), 21 | test("Properties failing")(FailingProperties.assertZIO()) @@ TestAspect.failing 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/AnnotationsSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.ZIO 4 | import zio.test.Assertion._ 5 | 6 | object AnnotationsSpec extends ZIOBaseSpec { 7 | 8 | def spec = suite("annotationsSpec")( 9 | test("withAnnotation returns annotation map with result") { 10 | for { 11 | map <- Annotations 12 | .withAnnotation(Annotations.annotate(count, 3) *> ZIO.fail(TestFailure.fail("fail"))) 13 | .flip 14 | .map(_.annotations) 15 | c = map.get(count) 16 | } yield assert(c)(equalTo(3)) 17 | } 18 | ) 19 | 20 | val count: TestAnnotation[Int] = TestAnnotation[Int]("count", 0, _ + _) 21 | } 22 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/LiveSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio._ 4 | import zio.test.Assertion._ 5 | 6 | import java.util.concurrent.TimeUnit 7 | 8 | object LiveSpec extends ZIOBaseSpec { 9 | 10 | def spec = suite("LiveSpec")( 11 | test("live can access real environment") { 12 | for { 13 | test <- Clock.currentTime(TimeUnit.MILLISECONDS) 14 | live <- Live.live(Clock.currentTime(TimeUnit.MILLISECONDS)) 15 | } yield assert(test)(equalTo(0L)) && assert(live)(not(equalTo(0L))) 16 | }, 17 | test("withLive provides real environment to single effect") { 18 | for { 19 | _ <- Live.withLive(Console.print("woot"))(_.delay(1.nanosecond)) 20 | result <- TestConsole.output 21 | } yield assert(result)(equalTo(Vector("woot"))) 22 | } 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/SmartTestTypes.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import java.time.LocalDateTime 4 | 5 | object SmartTestTypes { 6 | sealed trait Color 7 | 8 | case class Red(name: String) extends Color 9 | 10 | case class Blue(brightness: Int) extends Color 11 | 12 | case class Post(title: String, publishDate: Option[LocalDateTime] = None) 13 | 14 | case class User(name: String, posts: List[Post]) 15 | 16 | case class Company(name: String, users: List[User]) 17 | 18 | class Service(val name: String) 19 | 20 | class GenericService[A](val value: A) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/TestAnnotationMapSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.test.Assertion._ 4 | 5 | object TestAnnotationMapSpec extends ZIOBaseSpec { 6 | 7 | def spec = suite("TestAnnotationMapSpec")( 8 | test("get retrieves the annotation of the specified type") { 9 | val annotations = TestAnnotationMap.empty.annotate(TestAnnotation.ignored, 1) 10 | assert(annotations.get(TestAnnotation.ignored))(equalTo(1)) && 11 | assert(annotations.get(TestAnnotation.retried))(equalTo(0)) 12 | } 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/TestProvideSpecTypes.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{Ref, UIO} 4 | 5 | object TestProvideSpecTypes { 6 | 7 | final case class IntService(ref: Ref[Int]) { 8 | def add(int: Int): UIO[Int] = ref.updateAndGet(_ + int) 9 | } 10 | 11 | final case class StringService(ref: Ref[String]) { 12 | def append(string: String): UIO[String] = ref.updateAndGet(_ + string) 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/TestUtils.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{ExecutionStrategy, Random, UIO, ZIO} 4 | 5 | object TestUtils { 6 | 7 | def execute[E](spec: Spec[TestEnvironment, E]): UIO[Summary] = for { 8 | randomId <- ZIO.withRandom(Random.RandomLive)(Random.nextInt).map("test_case_" + _) 9 | summary <- defaultTestRunner.executor.run(randomId, spec, ExecutionStrategy.Sequential) 10 | } yield summary 11 | 12 | def isIgnored[E](spec: Spec[TestEnvironment, E]): UIO[Boolean] = 13 | execute(spec) 14 | .map(_.ignore > 0) 15 | 16 | def succeeded[E](spec: Spec[TestEnvironment, E]): UIO[Boolean] = 17 | execute(spec).map { summary => 18 | summary.fail == 0 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test-tests/shared/src/test/scala/zio/test/ZIOBaseSpec.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio._ 4 | 5 | trait ZIOBaseSpec extends ZIOSpecDefault { 6 | override def aspects: Chunk[TestAspectAtLeastR[TestEnvironment]] = 7 | if (TestPlatform.isJVM) Chunk(TestAspect.timeout(120.seconds), TestAspect.timed) 8 | else if (TestPlatform.isNative) 9 | Chunk(TestAspect.timeout(120.seconds), TestAspect.timed, TestAspect.size(10), TestAspect.samples(50)) 10 | else 11 | Chunk(TestAspect.timeout(120.seconds), TestAspect.sequential, TestAspect.timed, TestAspect.size(10)) 12 | } 13 | -------------------------------------------------------------------------------- /test/js/src/main/scala-2.12/zio/test/FieldExtractorPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.test 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[test] trait FieldExtractorPlatformSpecific { 22 | def productFields(obj: Product): Iterator[String] = Iterator.fill(obj.productArity)("") 23 | } 24 | -------------------------------------------------------------------------------- /test/js/src/main/scala/zio/test/results/ResultFileOpsJson.scala: -------------------------------------------------------------------------------- 1 | package zio.test.results 2 | 3 | import zio._ 4 | 5 | import java.io.IOException 6 | 7 | private[test] trait ResultFileOps { 8 | def write(content: => String, append: Boolean): ZIO[Any, IOException, Unit] 9 | } 10 | 11 | private[test] object ResultFileOps { 12 | val live: ZLayer[Any, Nothing, ResultFileOps] = 13 | ZLayer.succeed( 14 | Json() 15 | ) 16 | 17 | private[test] case class Json() extends ResultFileOps { 18 | def write(content: => String, append: Boolean): ZIO[Any, IOException, Unit] = 19 | ZIO.unit 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/js/src/main/scala/zio/test/results/ResultPrinterJson.scala: -------------------------------------------------------------------------------- 1 | package zio.test.results 2 | 3 | import zio._ 4 | import zio.test._ 5 | 6 | private[test] object ResultPrinterJson { 7 | val live: ZLayer[Any, Nothing, ResultPrinter] = 8 | ZLayer.make[ResultPrinter]( 9 | ResultSerializer.live, 10 | ResultFileOps.live, 11 | ZLayer.fromFunction( 12 | LiveImpl(_, _) 13 | ) 14 | ) 15 | 16 | private case class LiveImpl(serializer: ResultSerializer, resultFileOps: ResultFileOps) extends ResultPrinter { 17 | override def print[E](event: ExecutionEvent.Test[E]): ZIO[Any, Nothing, Unit] = 18 | resultFileOps.write(serializer.render(event), append = true).orDie 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/jvm-native/src/main/scala/zio/test/results/ResultPrinterJson.scala: -------------------------------------------------------------------------------- 1 | package zio.test.results 2 | 3 | import zio.test._ 4 | import zio.{ZIO, ZLayer} 5 | 6 | private[test] object ResultPrinterJson { 7 | val live: ZLayer[Any, Nothing, ResultPrinter] = 8 | ZLayer.make[ResultPrinter]( 9 | ResultSerializer.live, 10 | ResultFileOps.live, 11 | ZLayer.fromFunction(LiveImpl.apply _) 12 | ) 13 | 14 | private case class LiveImpl(serializer: ResultSerializer, resultFileOps: ResultFileOps) extends ResultPrinter { 15 | override def print[E](event: ExecutionEvent.Test[E]): ZIO[Any, Nothing, Unit] = 16 | resultFileOps.write(serializer.render(event)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/native/src/main/scala-2.12/zio/test/FieldExtractorPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.test 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | private[test] trait FieldExtractorPlatformSpecific { 22 | def productFields(obj: Product): Iterator[String] = Iterator.fill(obj.productArity)("") 23 | } 24 | -------------------------------------------------------------------------------- /test/shared/src/main/scala-2/zio/test/ZIOSpecAbstractVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | private[test] trait ZIOSpecAbstractVersionSpecific { 4 | 5 | /** 6 | * This implicit conversion macro will ensure that the provided ZIO effect 7 | * does not require more than the provided environment. 8 | * 9 | * If it is missing requirements, it will report a descriptive error message. 10 | * Otherwise, the effect will be returned unmodified. 11 | */ 12 | implicit def validateEnv[R1, R, E](spec: Spec[R, E]): Spec[R1, E] = 13 | macro SpecLayerMacros.validate[R1, R] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/shared/src/main/scala-2/zio/test/ZIOSpecVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | private[test] trait ZIOSpecVersionSpecific[R] { 4 | // SCALA 2 5 | 6 | def suiteAll(name: String)(spec: Any): Spec[Nothing, Any] = 7 | macro SmartSpecMacros.suiteImpl 8 | } 9 | -------------------------------------------------------------------------------- /test/shared/src/main/scala-2/zio/test/diff/Diff.scala: -------------------------------------------------------------------------------- 1 | package zio.test.diff 2 | 3 | trait Diff[A] { self => 4 | def diff(x: A, y: A): DiffResult 5 | 6 | final def contramap[B](f: B => A): Diff[B] = 7 | (x, y) => self.diff(f(x), f(y)) 8 | 9 | def isLowPriority: Boolean = false 10 | } 11 | 12 | object Diff extends DiffInstances { 13 | def apply[A](implicit diff: Diff[A]): Diff[A] = diff 14 | 15 | def render[A: Diff](oldValue: A, newValue: A): String = 16 | (oldValue diffed newValue).render 17 | 18 | implicit final class DiffOps[A](private val self: A)(implicit diff: Diff[A]) { 19 | def diffed(that: A): DiffResult = diff.diff(self, that) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/shared/src/main/scala-3/zio/test/diff/Diff.scala: -------------------------------------------------------------------------------- 1 | package zio.test.diff 2 | 3 | trait Diff[-A] { self => 4 | def diff(x: A, y: A): DiffResult 5 | 6 | final def contramap[B](f: B => A): Diff[B] = 7 | (x, y) => self.diff(f(x), f(y)) 8 | 9 | def isLowPriority: Boolean = false 10 | } 11 | 12 | object Diff extends DiffInstances { 13 | def apply[A](implicit diff: Diff[A]): Diff[A] = diff 14 | 15 | def render[A: Diff](oldValue: A, newValue: A): String = 16 | (oldValue diffed newValue).render 17 | 18 | implicit final class DiffOps[A](private val self: A)(implicit diff: Diff[A]) { 19 | def diffed(that: A): DiffResult = diff.diff(self, that) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/ConsoleIO.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | private[test] sealed trait ConsoleIO 4 | private[test] object ConsoleIO { 5 | case class Input(line: String) extends ConsoleIO 6 | case class Output(line: String) extends ConsoleIO 7 | } 8 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/ExecutionEventConsolePrinter.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio._ 4 | 5 | private[test] trait ExecutionEventConsolePrinter { 6 | def print(event: ExecutionEvent): ZIO[Any, Nothing, Unit] 7 | } 8 | 9 | private[test] object ExecutionEventConsolePrinter { 10 | def live(renderer: ReporterEventRenderer): ZLayer[TestLogger, Nothing, ExecutionEventConsolePrinter] = 11 | ZLayer { 12 | for { 13 | testLogger <- ZIO.service[TestLogger] 14 | } yield Live(testLogger, renderer) 15 | } 16 | 17 | case class Live(logger: TestLogger, eventRenderer: ReporterEventRenderer) extends ExecutionEventConsolePrinter { 18 | override def print(event: ExecutionEvent): ZIO[Any, Nothing, Unit] = { 19 | val rendered = eventRenderer.render(event) 20 | ZIO 21 | .when(rendered.nonEmpty)( 22 | logger.logLine( 23 | rendered.mkString("\n") 24 | ) 25 | ) 26 | .unit 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/ReporterEventRenderer.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.stacktracer.TracingImplicits.disableAutoTrace 4 | import zio.{Chunk, Trace} 5 | import zio.test.render.{ConsoleRenderer, IntelliJRenderer} 6 | 7 | trait ReporterEventRenderer { 8 | def render(event: ExecutionEvent)(implicit trace: Trace): Chunk[String] 9 | } 10 | object ReporterEventRenderer { 11 | object ConsoleEventRenderer extends ReporterEventRenderer { 12 | override def render(executionEvent: ExecutionEvent)(implicit trace: Trace): Chunk[String] = 13 | Chunk.fromIterable( 14 | ConsoleRenderer 15 | .render(executionEvent, includeCause = true) 16 | ) 17 | } 18 | 19 | object IntelliJEventRenderer extends ReporterEventRenderer { 20 | override def render(executionEvent: ExecutionEvent)(implicit trace: Trace): Chunk[String] = 21 | Chunk.fromIterable( 22 | IntelliJRenderer 23 | .render(executionEvent, includeCause = true) 24 | ) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/Restorable.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.test 18 | 19 | import zio.{UIO, Trace} 20 | import zio.stacktracer.TracingImplicits.disableAutoTrace 21 | 22 | trait Restorable extends Serializable { 23 | def save(implicit trace: Trace): UIO[UIO[Unit]] 24 | } 25 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/SuiteId.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{Random, ZIO} 4 | 5 | import java.util.UUID 6 | import java.util.concurrent.atomic.AtomicInteger 7 | 8 | /** 9 | * @param id 10 | * Level of the spec nesting that you are at. Suites get new values, test 11 | * cases inherit their suite's 12 | */ 13 | case class SuiteId(id: Int) 14 | 15 | object SuiteId { 16 | val global: SuiteId = SuiteId(0) 17 | 18 | private val counter = new AtomicInteger(1) 19 | 20 | val newRandom: ZIO[Any, Nothing, SuiteId] = 21 | for { 22 | // TODO Consider counting up from 0, rather than completely random ints 23 | random <- ZIO.succeed(counter.getAndIncrement()) 24 | } yield SuiteId(random) 25 | } 26 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/TestDebugFileLock.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{Ref, ZIO} 4 | 5 | private[test] object TestDebugFileLock { 6 | def make: ZIO[Any, Nothing, TestDebugFileLock] = 7 | Ref.Synchronized.make[Unit](()).map(TestDebugFileLock(_)) 8 | } 9 | 10 | private[test] case class TestDebugFileLock(lock: Ref.Synchronized[Unit]) { 11 | def updateFile(action: ZIO[Any, Nothing, Unit]) = 12 | lock.updateZIO(_ => action) 13 | } 14 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/TestReporters.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{Ref, ZIO} 4 | 5 | object TestReporters { 6 | val make: ZIO[Any, Nothing, TestReporters] = 7 | // This SuiteId should probably be passed in a more obvious way 8 | Ref.make(List(SuiteId.global)).map(TestReporters(_)) 9 | } 10 | 11 | case class TestReporters(reportersStack: Ref[List[SuiteId]]) { 12 | 13 | def attemptToGetPrintingControl(id: SuiteId, ancestors: List[SuiteId]): ZIO[Any, Nothing, Boolean] = 14 | reportersStack.updateSomeAndGet { 15 | case Nil => 16 | List(id) 17 | 18 | case reporters if ancestors.nonEmpty && reporters.head == ancestors.head => 19 | id :: reporters 20 | }.map(_.head == id) 21 | 22 | def relinquishPrintingControl(id: SuiteId): ZIO[Any, Nothing, Unit] = 23 | reportersStack.updateSome { 24 | case currentReporter :: reporters if currentReporter == id => 25 | reporters 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/TestTimeoutException.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 John A. De Goes and the ZIO Contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package zio.test 18 | 19 | import zio.stacktracer.TracingImplicits.disableAutoTrace 20 | 21 | final case class TestTimeoutException(message: String) extends Throwable(message, null, true, false) 22 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/ZIOSpecDefault.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio._ 4 | import zio.internal.stacktracer.Tracer 5 | import zio.internal.stacktracer.Tracer.{instance, newTrace} 6 | import zio.stacktracer.TracingImplicits.disableAutoTrace 7 | 8 | abstract class ZIOSpecDefault extends ZIOSpec[TestEnvironment] { 9 | 10 | override val bootstrap: ZLayer[Any, Any, TestEnvironment] = 11 | testEnvironment 12 | 13 | def spec: Spec[TestEnvironment with Scope, Any] 14 | } 15 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/ZTestEventHandler.scala: -------------------------------------------------------------------------------- 1 | package zio.test 2 | 3 | import zio.{UIO, ZIO} 4 | 5 | trait ZTestEventHandler { 6 | def handle(event: ExecutionEvent): UIO[Unit] 7 | } 8 | object ZTestEventHandler { 9 | val silent: ZTestEventHandler = _ => ZIO.unit 10 | } 11 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/internal/OptionalImplicit.scala: -------------------------------------------------------------------------------- 1 | package zio.test.internal 2 | 3 | import zio.stacktracer.TracingImplicits.disableAutoTrace 4 | 5 | trait OptionalImplicit[A] { 6 | def value: Option[A] 7 | } 8 | 9 | object OptionalImplicit extends LowPriOptionalImplicit { 10 | def apply[A: OptionalImplicit]: Option[A] = implicitly[OptionalImplicit[A]].value 11 | 12 | implicit def some[A](implicit instance: A): OptionalImplicit[A] = new OptionalImplicit[A] { 13 | val value: Option[A] = Some(instance) 14 | } 15 | } 16 | 17 | trait LowPriOptionalImplicit { 18 | implicit def none[A]: OptionalImplicit[A] = new OptionalImplicit[A] { 19 | val value: Option[A] = None 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/shared/src/main/scala/zio/test/results/TestResultPrinter.scala: -------------------------------------------------------------------------------- 1 | package zio.test.results 2 | 3 | import zio.{ZIO, ZLayer} 4 | import zio.test.ExecutionEvent 5 | 6 | trait ResultPrinter { 7 | def print[E](event: ExecutionEvent.Test[E]): ZIO[Any, Nothing, Unit] 8 | } 9 | 10 | object ResultPrinter { 11 | val json: ZLayer[Any, Nothing, ResultPrinter] = ResultPrinterJson.live 12 | } 13 | -------------------------------------------------------------------------------- /website/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "plugins": ["prettier-plugin-tailwindcss"] 4 | } 5 | -------------------------------------------------------------------------------- /website/.yarnrc: -------------------------------------------------------------------------------- 1 | save-exact true 2 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /website/patch-guides.sh: -------------------------------------------------------------------------------- 1 | ln -s documentation/guides/tutorials/make-a-zio-app-configurable/docs/make-a-zio-application-configurable.md website/docs/guides/tutorials/ -------------------------------------------------------------------------------- /website/plugins/zio-ecosystem-docusaurus/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "allowSyntheticDefaultImports": true, 5 | "allowJs": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('@tailwindcss/postcss') 4 | ], 5 | } 6 | -------------------------------------------------------------------------------- /website/src/components/EmbeddedVideo/Poster/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import clsx from 'clsx'; 3 | import { FaYoutube } from 'react-icons/fa'; 4 | 5 | import styles from './styles.module.css'; 6 | 7 | export default function Poster({ 8 | className, 9 | posterUrl, 10 | onPointerOver, 11 | onClick, 12 | }) { 13 | return ( 14 | <div 15 | className={clsx('card aspect-video', styles.poster, className)} 16 | style={{ backgroundImage: `url(${posterUrl})` }} 17 | onPointerOver={onPointerOver} 18 | onClick={onClick} 19 | > 20 | <FaYoutube className={styles.posterYTButton} /> 21 | </div> 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /website/src/components/EmbeddedVideo/Poster/styles.module.css: -------------------------------------------------------------------------------- 1 | .poster { 2 | height: auto; 3 | background-repeat: no-repeat; 4 | background-size: cover; 5 | background-position: center; 6 | display: flex; 7 | align-items: center; 8 | justify-content: center; 9 | cursor: pointer; 10 | position: relative; 11 | } 12 | 13 | .poster::before { 14 | content: ''; 15 | width: 30px; 16 | height: 30px; 17 | background-color: #ffffff; 18 | position: absolute; 19 | z-index: 0; 20 | } 21 | 22 | .poster::after { 23 | content: ''; 24 | position: absolute; 25 | top: 0; 26 | left: 0; 27 | width: 100%; 28 | height: 100%; 29 | z-index: 1; 30 | background: linear-gradient( 31 | to bottom, 32 | rgb(0, 0, 0, 0.3) 0%, 33 | transparent 25%, 34 | transparent 75%, 35 | rgb(0, 0, 0, 0.3) 100% 36 | ); 37 | } 38 | 39 | .posterYTButton { 40 | color: #ff0100; 41 | width: 88px; 42 | height: 63px; 43 | z-index: 1; 44 | } 45 | -------------------------------------------------------------------------------- /website/src/components/EmbeddedVideo/Video/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import clsx from 'clsx'; 3 | 4 | import styles from './styles.module.css'; 5 | 6 | export default function Video({ video, title, className }) { 7 | return ( 8 | <div className={clsx('card', styles.card, className)}> 9 | <iframe 10 | className={clsx('aspect-video', styles.iframe)} 11 | src={`https://www.youtube.com/embed/${video}`} 12 | title={title} 13 | allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 14 | allowFullScreen 15 | /> 16 | </div> 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /website/src/components/EmbeddedVideo/Video/styles.module.css: -------------------------------------------------------------------------------- 1 | .card { 2 | height: auto; 3 | } 4 | 5 | .iframe { 6 | width: 100%; 7 | } 8 | -------------------------------------------------------------------------------- /website/src/components/sections/Sponsors/data.js: -------------------------------------------------------------------------------- 1 | export const sponsors = [ 2 | { 3 | image: `/img/ziverge.png`, 4 | imageAlt: 'Ziverge', 5 | imageLink: 'https://ziverge.com', 6 | content: 'Brilliant solutions for innovative companies', 7 | }, 8 | { 9 | image: `/img/septimal_mind.svg`, 10 | imageAlt: 'Septimal Mind', 11 | imageLink: 'https://7mind.io/', 12 | content: 'Inventing productivity', 13 | }, 14 | ]; 15 | -------------------------------------------------------------------------------- /website/src/components/ui/SectionWrapper/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './styles.module.css'; 3 | 4 | export default function SectionWrapper({ title, subtitle, children }) { 5 | return ( 6 | <section className="py-10"> 7 | {title ? ( 8 | <div className="container mb-10"> 9 | <h2 className="text-center text-4xl font-bold">{title}</h2> 10 | </div> 11 | ) : null} 12 | {subtitle ? ( 13 | <div className="col col--12 text--center"> 14 | <p className={styles.subtitle}>{subtitle}</p> 15 | </div> 16 | ): null} 17 | {children} 18 | </section> 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /website/src/components/ui/SectionWrapper/styles.module.css: -------------------------------------------------------------------------------- 1 | .subtitle { 2 | font-size: 1.2rem; 3 | color: var(--ifm-color-emphasis-700); 4 | max-width: 800px; 5 | margin: 0 auto; 6 | } 7 | -------------------------------------------------------------------------------- /website/src/theme/Footer/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "@theme-original/Footer"; 3 | import { ChatApp } from "@bytebrain.ai/bytebrain-ui"; 4 | 5 | export default function FooterWrapper(props) { 6 | return ( 7 | <> 8 | <Footer {...props} /> 9 | <ChatApp 10 | websocketHost="chat.zio.dev" 11 | websocketPort="80" 12 | websocketEndpoint="/chat" 13 | /> 14 | </> 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/.nojekyll -------------------------------------------------------------------------------- /website/static/img/assets/comparing-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/comparing-changes.png -------------------------------------------------------------------------------- /website/static/img/assets/edit-this-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/edit-this-page.png -------------------------------------------------------------------------------- /website/static/img/assets/github-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/github-editor.png -------------------------------------------------------------------------------- /website/static/img/assets/hub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/hub.png -------------------------------------------------------------------------------- /website/static/img/assets/open-a-pull-request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/open-a-pull-request.png -------------------------------------------------------------------------------- /website/static/img/assets/propose-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/propose-changes.png -------------------------------------------------------------------------------- /website/static/img/assets/zio-streams-1.x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/zio-streams-1.x.png -------------------------------------------------------------------------------- /website/static/img/assets/zio-streams-2.x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/zio-streams-2.x.png -------------------------------------------------------------------------------- /website/static/img/assets/zio-streams-zchannel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/assets/zio-streams-zchannel.png -------------------------------------------------------------------------------- /website/static/img/discord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/discord.png -------------------------------------------------------------------------------- /website/static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/favicon.png -------------------------------------------------------------------------------- /website/static/img/jumbotron_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/jumbotron_pattern.png -------------------------------------------------------------------------------- /website/static/img/navbar_brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/navbar_brand.png -------------------------------------------------------------------------------- /website/static/img/navbar_brand2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/navbar_brand2x.png -------------------------------------------------------------------------------- /website/static/img/sidebar_brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/sidebar_brand.png -------------------------------------------------------------------------------- /website/static/img/sidebar_brand2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/sidebar_brand2x.png -------------------------------------------------------------------------------- /website/static/img/users/adgear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/adgear.png -------------------------------------------------------------------------------- /website/static/img/users/audela.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/audela.png -------------------------------------------------------------------------------- /website/static/img/users/ayolab-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/ayolab-black.png -------------------------------------------------------------------------------- /website/static/img/users/ayolab-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/ayolab-white.png -------------------------------------------------------------------------------- /website/static/img/users/calcbank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/calcbank.png -------------------------------------------------------------------------------- /website/static/img/users/callhandling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/callhandling.png -------------------------------------------------------------------------------- /website/static/img/users/carvana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/carvana.png -------------------------------------------------------------------------------- /website/static/img/users/cloudfarms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/cloudfarms.png -------------------------------------------------------------------------------- /website/static/img/users/colisweb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/colisweb.png -------------------------------------------------------------------------------- /website/static/img/users/compellon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/compellon.png -------------------------------------------------------------------------------- /website/static/img/users/datachef.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/datachef.png -------------------------------------------------------------------------------- /website/static/img/users/de-solution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/de-solution.png -------------------------------------------------------------------------------- /website/static/img/users/demyst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/demyst.png -------------------------------------------------------------------------------- /website/static/img/users/devsisters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/devsisters.png -------------------------------------------------------------------------------- /website/static/img/users/doomoolmori.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/doomoolmori.png -------------------------------------------------------------------------------- /website/static/img/users/dow-jones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/dow-jones.png -------------------------------------------------------------------------------- /website/static/img/users/dpg-recruitment.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/dpg-recruitment.jpeg -------------------------------------------------------------------------------- /website/static/img/users/dpg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/dpg.jpeg -------------------------------------------------------------------------------- /website/static/img/users/eaglescience.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/eaglescience.png -------------------------------------------------------------------------------- /website/static/img/users/eaglescience2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/eaglescience2.png -------------------------------------------------------------------------------- /website/static/img/users/evo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/evo.png -------------------------------------------------------------------------------- /website/static/img/users/flipp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/flipp.png -------------------------------------------------------------------------------- /website/static/img/users/fugo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/fugo.png -------------------------------------------------------------------------------- /website/static/img/users/gleancompany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/gleancompany.png -------------------------------------------------------------------------------- /website/static/img/users/grandparade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/grandparade.png -------------------------------------------------------------------------------- /website/static/img/users/hunters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/hunters.jpg -------------------------------------------------------------------------------- /website/static/img/users/iheart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/iheart.png -------------------------------------------------------------------------------- /website/static/img/users/lambdaworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/lambdaworks.png -------------------------------------------------------------------------------- /website/static/img/users/liveintent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/liveintent.png -------------------------------------------------------------------------------- /website/static/img/users/logo-references.md: -------------------------------------------------------------------------------- 1 | | adgear.com | adgear | png | ??? | 2 | | Adidas.com | adidas | svg | https://commons.wikimedia.org/wiki/File:Adidas_Logo.svg | 3 | | Adpulse.io | adpulse | svg | https://res.cloudinary.com/adpulse-io/images/v1635909477/Adpulse.io-Logo-Colour_393615515d/Adpulse.io-Logo-Colour_393615515d.svg?_i=AA | 4 | | Adsquare.com | adsquare | svg | https://adsquare.com/wp-content/uploads/2021/10/logo-adsquare.svg | 5 | | Ayolab | ayolab-white | svg | https://www.ayolab.com/wp-content/themes/ayolab/assets/images/ayolab-white.png | 6 | | Ayolab | ayolab-black | svg | https://www.ayolab.com/wp-content/themes/ayolab/assets/images/ayolab-black.png | 7 | | Asana | asana | svg | https://asana.com/brand | 8 | | Aurinko | aurinko | svg | https://www.aurinko.io/images/inhtml/logo.svg | 9 | | auto.ru | auto | svg | https://auto.ru/ | 10 | | 11 | -------------------------------------------------------------------------------- /website/static/img/users/megogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/megogo.png -------------------------------------------------------------------------------- /website/static/img/users/mylivn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/mylivn.png -------------------------------------------------------------------------------- /website/static/img/users/ocadogroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/ocadogroup.png -------------------------------------------------------------------------------- /website/static/img/users/optrak.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/optrak.jpg -------------------------------------------------------------------------------- /website/static/img/users/performance-immo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/performance-immo.png -------------------------------------------------------------------------------- /website/static/img/users/playtika.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/playtika.png -------------------------------------------------------------------------------- /website/static/img/users/ppcsamurai.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/ppcsamurai.jpg -------------------------------------------------------------------------------- /website/static/img/users/rudder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/rudder.png -------------------------------------------------------------------------------- /website/static/img/users/sanjagh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/sanjagh.png -------------------------------------------------------------------------------- /website/static/img/users/securityscorecard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/securityscorecard.png -------------------------------------------------------------------------------- /website/static/img/users/signicat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/signicat.png -------------------------------------------------------------------------------- /website/static/img/users/streamweaver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/streamweaver.png -------------------------------------------------------------------------------- /website/static/img/users/stuart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/stuart.png -------------------------------------------------------------------------------- /website/static/img/users/tinkoff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/tinkoff.png -------------------------------------------------------------------------------- /website/static/img/users/tomtom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/tomtom.png -------------------------------------------------------------------------------- /website/static/img/users/tweddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/tweddle.png -------------------------------------------------------------------------------- /website/static/img/users/univalence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/univalence.png -------------------------------------------------------------------------------- /website/static/img/users/valamis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/valamis.png -------------------------------------------------------------------------------- /website/static/img/users/vish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/vish.png -------------------------------------------------------------------------------- /website/static/img/users/vivid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/vivid.png -------------------------------------------------------------------------------- /website/static/img/users/wehkamp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/wehkamp.png -------------------------------------------------------------------------------- /website/static/img/users/werkenbijdhl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/werkenbijdhl.png -------------------------------------------------------------------------------- /website/static/img/users/wolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/users/wolt.png -------------------------------------------------------------------------------- /website/static/img/yourkit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/yourkit.png -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk-01.png -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk-01.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk-01.psd -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk.ai -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk.eps -------------------------------------------------------------------------------- /website/static/img/zio-CMYK/zio-full-color-cmyk.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-CMYK/zio-full-color-cmyk.pdf -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.ai -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.eps -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.jpg -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.pdf -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.png -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio full color RGB/zio-full-color-rgb.psd -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-invert-rgb-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-invert-rgb-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb-01.png -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.ai -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.eps -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/black-rgb/zio-black-rgb.pdf -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-invert-rgb-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-invert-rgb-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb-01.png -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.ai -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.eps -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/red-rgb/zio-red-rgb.pdf -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-invert-rgb-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-invert-rgb-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb-01.png -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.ai -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.eps -------------------------------------------------------------------------------- /website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-RGB/zio-monochromes-rgb/white-rgb/zio-white-rgb.pdf -------------------------------------------------------------------------------- /website/static/img/zio-github/zio-github-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-github/zio-github-01.png -------------------------------------------------------------------------------- /website/static/img/zio-github/zio-github.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-github/zio-github.ai -------------------------------------------------------------------------------- /website/static/img/zio-github/zio-github.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-github/zio-github.eps -------------------------------------------------------------------------------- /website/static/img/zio-github/zio-github.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-github/zio-github.pdf -------------------------------------------------------------------------------- /website/static/img/zio-runtime-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-runtime-system.png -------------------------------------------------------------------------------- /website/static/img/zio-splash/zio-splash-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-splash/zio-splash-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-splash/zio-splash.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-splash/zio-splash.ai -------------------------------------------------------------------------------- /website/static/img/zio-splash/zio-splash.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-splash/zio-splash.eps -------------------------------------------------------------------------------- /website/static/img/zio-splash/zio-splash.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-splash/zio-splash.pdf -------------------------------------------------------------------------------- /website/static/img/zio-splash/zio-splash.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-splash/zio-splash.psd -------------------------------------------------------------------------------- /website/static/img/zio-twitter/zio-twitter-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-twitter/zio-twitter-01.jpg -------------------------------------------------------------------------------- /website/static/img/zio-twitter/zio-twitter.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-twitter/zio-twitter.ai -------------------------------------------------------------------------------- /website/static/img/zio-twitter/zio-twitter.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-twitter/zio-twitter.eps -------------------------------------------------------------------------------- /website/static/img/zio-twitter/zio-twitter.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio-twitter/zio-twitter.pdf -------------------------------------------------------------------------------- /website/static/img/zio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zio.png -------------------------------------------------------------------------------- /website/static/img/zionomicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/zionomicon.png -------------------------------------------------------------------------------- /website/static/img/ziverge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zio/zio/fb2cce70fe1a7467e6ff73c2a5a8643d21768e20/website/static/img/ziverge.png -------------------------------------------------------------------------------- /website/tailwind.config.js: -------------------------------------------------------------------------------- 1 | // tailwind.config.js 2 | const colors = require('tailwindcss/colors'); 3 | 4 | /** @type {import('tailwindcss').Config} */ 5 | module.exports = { 6 | important: true, 7 | content: ['./src/**/*.{js,jsx,ts,tsx}', './docs/**/*.mdx'], 8 | darkMode: ['class', '[data-theme="dark"]'], // hooks into docusaurus' dark mode settings 9 | theme: { 10 | extend: { 11 | colors: { 12 | primary: { 13 | DEFAULT: colors.red[600], 14 | ...colors.red, 15 | }, 16 | accent: { 17 | DEFAULT: colors.amber[500], 18 | ...colors.amber, 19 | }, 20 | }, 21 | }, 22 | }, 23 | plugins: [], 24 | }; 25 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/about/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: about_index 3 | title: "About ZIO" 4 | --- 5 | 6 | Type-safe, composable asynchronous and concurrent programming for Scala 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/guides/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Guides" 4 | --- 5 | 6 | Here are a few howto guides for common patterns with ZIO. 7 | 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/guides/interop/with-guava.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: with-guava 3 | title: "How to Interop with Guava?" 4 | --- 5 | 6 | [`interop-guava`](https://github.com/zio/interop-guava) module provide capibility to convert [Guava's `com.google.common.util.concurrent.ListenableFuture`](https://github.com/google/guava/wiki/ListenableFutureExplained) into ZIO `Task`. 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/guides/interop/with-twitter.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: with-twitter 3 | title: "How to Interop with Twitter?" 4 | --- 5 | 6 | [`interop-twitter`](https://github.com/zio/interop-twitter) module provides capability to convert [Twitter `Future`](https://twitter.github.io/util/docs/com/twitter/util/Future.html) into ZIO `Task`. 7 | 8 | ### Example 9 | 10 | ```scala 11 | import com.twitter.util.Future 12 | import zio.{ App, Task } 13 | import zio.console._ 14 | import zio.interop.twitter._ 15 | 16 | object Example extends App { 17 | def run(args: List[String]) = { 18 | val program = 19 | for { 20 | _ <- putStrLn("Hello! What is your name?") 21 | name <- getStrLn 22 | greeting <- Task.fromTwitterFuture(Task(greet(name))) 23 | _ <- putStrLn(greeting) 24 | } yield () 25 | 26 | program.exitCode 27 | } 28 | 29 | private def greet(name: String): Future[String] = Future.value(s"Hello, $name!") 30 | } 31 | ``` 32 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/guides/migrate/from-cats-efect.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: from-cats-efect 3 | title: "How to Migrate from Cats Effect to ZIO?" 4 | --- 5 | 6 | Cats `IO[A]` can be easily replaced with ZIO's `Task[A]` (an alias for `ZIO[Any, Throwable, A]`). 7 | Translation should be relatively straightfoward. Below, you'll find tables showing the ZIO equivalents of 8 | various `cats.*`'s methods. 9 | 10 | ### Methods on cats.FlatMap.Ops 11 | 12 | | cats | ZIO | 13 | |-------|-----| 14 | |`flatMap`|`flatMap`| 15 | |`flatten`|`flatten`| 16 | |`productREval`|`zipRight`| 17 | |`productLEval`|`zipLeft`| 18 | |`mproduct`|`zipPar`| 19 | |`flatTap`|`tap`| 20 | 21 | ### TODO 22 | 23 | TODO -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/overview/performance.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: overview_performance 3 | title: "Performance" 4 | --- 5 | 6 | `zio` has excellent performance, featuring a hand-optimized, low-level interpreter that achieves zero allocations for right-associated binds, and minimal allocations for left-associated binds. 7 | 8 | The `benchmarks` project may be used to compare `IO` with other effect monads, including `Future` (which is not an effect monad but is included for reference), Monix `Task`, and Cats `IO`. 9 | 10 | As of the time of this writing, `IO` is significantly faster than or at least comparable to all other purely functional solutions. 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/contextual/layer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: layer 3 | title: "Layer" 4 | --- 5 | 6 | `Layer[+E, +ROut]` is a type alias for `ZLayer[Any, E, ROut]`, which represents a layer that doesn't require any services, it may fail with an error type of `E`, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type Layer[+E, +ROut] = ZLayer[Any, E, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/contextual/rlayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: rlayer 3 | title: "RLayer" 4 | --- 5 | 6 | `RLayer[-RIn, +ROut]` is a type alias for `ZLayer[RIn, Throwable, ROut]`, which represents a layer that requires `RIn` as its input, it may fail with `Throwable` value, or returns `ROut` as its output. 7 | 8 | ```scala 9 | type RLayer[-RIn, +ROut] = ZLayer[RIn, Throwable, ROut] 10 | ``` -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/contextual/task-layer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tasklayer 3 | title: "TaskLayer" 4 | --- 5 | 6 | `TaskLayer[+ROut]` is a type alias for `ZLayer[Any, Throwable, ROut]`, which represents a layer that doesn't require any services as its input, it may fail with `Throwable` value, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type TaskLayer[+ROut] = ZLayer[Any, Throwable, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/contextual/ulayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: ulayer 3 | title: "ULayer" 4 | --- 5 | 6 | `ULayer[+ROut]` is a type alias for `ZLayer[Any, Nothing, ROut]`, which represents a layer that doesn't require any services as its input, it can't fail, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type ULayer[+ROut] = ZLayer[Any, Nothing, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/contextual/urlayer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: urlayer 3 | title: "URLayer" 4 | --- 5 | 6 | `URLayer[-RIn, +ROut]` is a type alias for `ZLayer[RIn, Nothing, ROut]`, which represents a layer that requires `RIn` as its input, it can't fail, and returns `ROut` as its output. 7 | 8 | ```scala 9 | type URLayer[-RIn, +ROut] = ZLayer[RIn, Nothing, ROut] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/core/exit.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: exit 3 | title: "Exit" 4 | --- 5 | 6 | An `Exit[E, A]` value describes how fibers end life. It has two possible values: 7 | - `Exit.Success` contain a success value of type `A`. 8 | - `Exit.Failure` contains a failure [Cause](cause.md) of type `E`. 9 | 10 | We can call `run` on our effect to determine the Success or Failure of our fiber: 11 | 12 | ```scala 13 | import zio._ 14 | import zio.console._ 15 | for { 16 | successExit <- ZIO.succeed(1).run 17 | _ <- successExit match { 18 | case Exit.Success(value) => 19 | putStrLn(s"exited with success value: ${value}") 20 | case Exit.Failure(cause) => 21 | putStrLn(s"exited with failure state: $cause") 22 | } 23 | } yield () 24 | ``` -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/core/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Summary" 4 | --- 5 | 6 | - **[ZIO](zio.md)** — A `ZIO` is a value that models an effectful program, which might fail or succeed. 7 | + **[UIO](uio.md)** — An `UIO[A]` is a type alias for `ZIO[Any, Nothing, A]`. 8 | + **[URIO](urio.md)** — An `URIO[R, A]` is a type alias for `ZIO[R, Nothing, A]`. 9 | + **[Task](task.md)** — A `Task[A]` is a type alias for `ZIO[Any, Throwable, A]`. 10 | + **[RIO](rio.md)** — A `RIO[R, A]` is a type alias for `ZIO[R, Throwable, A]`. 11 | + **[IO](io.md)** — An `IO[E, A]` is a type alias for `ZIO[Any, E, A]`. 12 | - **[Exit](exit.md)** — An `Exit[E, A]` describes the result of executing an `IO` value. 13 | - **[Cause](cause.md)** - `Cause[E]` is a description of a full story of a fiber failure. 14 | - **[Runtime](runtime.md)** — A `Runtime[R]` is capable of executing tasks within an environment `R`. 15 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/fiber/fiberid.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fiberid 3 | title: "Fiber.Id" 4 | --- 5 | 6 | The identity of a [Fiber](fiber.md), described by the time it began life (`startTimeMillis`), and a monotonically increasing sequence number generated from an atomic counter (`seqNumber`). 7 | 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/fiber/fiberstatus.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: fiberstatus 3 | title: "Fiber.Status" 4 | --- 5 | 6 | `Fiber.Status` describe the current status of a [Fiber](fiber.md). 7 | 8 | Each fiber can be in one of the following statues: 9 | - Done 10 | - Finishing 11 | - Running 12 | - Suspended 13 | 14 | In the following example, we are going to `await` on a never-ending fiber and determine the id of that fiber, which we are blocking on: 15 | 16 | ```scala 17 | import zio._ 18 | import zio.console._ 19 | for { 20 | f1 <- ZIO.never.fork 21 | f2 <- f1.await.fork 22 | blockingOn <- f2.status 23 | .collect(()) { case Fiber.Status.Suspended(_, _, _, blockingOn, _) => 24 | blockingOn 25 | } 26 | .eventually 27 | } yield (assert(blockingOn == List(f1.id))) 28 | ``` 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/misc/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Summary" 4 | --- 5 | 6 | - **[Chunk](chunk.md)** — ZIO `Chunk`: Fast, Pure Alternative to Arrays 7 | - **[Schedule](schedule.md)** — A `Schedule` is a model of a recurring schedule, which can be used for repeating successful `IO` values, or retrying failed `IO` values. 8 | - **[Supervisor](supervisor.md)** — Supervising the launching and termination of fibers. 9 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/resource/rmanaged.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: rmanaged 3 | title: "RManaged" 4 | --- 5 | 6 | `RManaged[R, A]` is a type alias for `ZManaged[R, Throwable, A]`, which represents a managed resource that requires an `R`, and may fail with a `Throwable` value, or succeed with an `A`. 7 | 8 | 9 | The `RManaged` type alias is defined as follows: 10 | 11 | ```scala 12 | type RManaged[-R, +A] = ZManaged[R, Throwable, A] 13 | ``` 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/resource/task-managed.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: task-managed 3 | title: "TaskManaged" 4 | --- 5 | 6 | `TaskManaged[A]` is a type alias for `ZManaged[Any, Throwable, A]`, which represents a managed resource that has no requirements, and may fail with a `Throwable` value, or succeed with an `A`. 7 | 8 | 9 | The `TaskManaged` type alias is defined as follows: 10 | 11 | ```scala 12 | type TaskManaged[+A] = ZManaged[Any, Throwable, A] 13 | ``` 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/resource/umanaged.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: umanaged 3 | title: "UManaged" 4 | --- 5 | 6 | `UManaged[A]` is a type alias for `ZManaged[Any, Nothing, A]`, which represents an **unexceptional** managed resource that doesn't require any specific environment, and cannot fail, but can succeed with an `A`. 7 | 8 | 9 | The `UMManaged` type alias is defined as follows: 10 | 11 | ```scala 12 | type UManaged[+A] = ZManaged[Any, Nothing, A] 13 | ``` 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/resource/urmanaged.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: urmanaged 3 | title: "URManaged" 4 | --- 5 | 6 | `URManaged[R, A]` is a type alias for `ZManaged[R, Nothing, A]`, which represents a managed resource that requires an `R`, and cannot fail, but can succeed with an `A`. 7 | 8 | 9 | The `URManaged` type alias is defined as follows: 10 | 11 | ```scala 12 | type URManaged[-R, +A] = ZManaged[R, Nothing, A] 13 | ``` 14 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/services/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Introduction" 4 | --- 5 | 6 | ZIO already provided 5 build-in services, when we use these services we don't need to provide their corresponding environment explicitly. The `ZEnv` environment is a type alias for all of these services and will be provided by ZIO to our effects: 7 | 8 | - **[Console](console.md)** — Operations for reading/writing strings from/to the standard input, output, and error console. 9 | - **[Clock](clock.md)** — Contains some functionality related to time and scheduling. 10 | - **[Random](random.md)** — Provides utilities to generate random numbers. 11 | - **[Blocking](blocking.md)** — Provides access to a thread pool that can be used for performing blocking operations. 12 | - **[System](system.md)** — Contains several useful functions related to system environments and properties. 13 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/stream/sink.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: sink 3 | title: "Sink" 4 | --- 5 | 6 | `Sink[E, A, L, B]` is a type alias for `ZSink[Any, E, A, L, B]`. We can think of a `Sink` as a function that does not require any services and will consume a variable amount of `A` elements (could be 0, 1, or many!), might fail with an error of type `E`, and will eventually yield a value of type `B`. The `L` is the type of elements in the leftover. 7 | 8 | ```scala 9 | type Sink[+E, A, +L, +B] = ZSink[Any, E, A, L, B] 10 | ``` -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/stream/stream.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: stream 3 | title: "Stream" 4 | --- 5 | 6 | `Stream[E, A]` is a type alias for `ZStream[Any, E, A]`, which represents a ZIO stream that does not require any services, and may fail with an `E`, or produce elements with an `A`. 7 | 8 | ```scala 9 | type Stream[+E, +A] = ZStream[Any, E, A] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/stream/transducer.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: transducer 3 | title: "Transducer" 4 | --- 5 | 6 | `Transducer[E, A, B]` is a type alias for `ZTransducer[Any, E, A, B]`. It is a stream transducer that doesn't require any services, so except the `R` type-parameter, all other things are the same. 7 | 8 | ```scala 9 | type Transducer[+E, -A, +B] = ZTransducer[Any, E, A, B] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/reference/stream/ustream.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: ustream 3 | title: "UStream" 4 | --- 5 | 6 | `UStream[A]` is a type alias for `ZStream[Any, Nothing, A]`, which represents a ZIO stream that does not require any services, it cannot fail, and after evaluation, it may emit zero or more values of type `A`. 7 | 8 | ```scala 9 | type UStream[+A] = ZStream[Any, Nothing, A] 10 | ``` 11 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/resources/ecosystem/templates.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: templates 3 | title: "Project Templates" 4 | --- 5 | 6 | List of project starters, bootstrap tools or, templates. 7 | 8 | - [zio-akka-quickstart.g8](https://github.com/ScalaConsultants/zio-akka-quickstart.g8) — A Giter8 template for a basic Scala application build using ZIO, Akka HTTP and Slick 9 | - [zio-dotty-quickstart.g8](https://github.com/ScalaConsultants/zio-dotty-quickstart.g8) — A Giter8 template for a basic Dotty application build using ZIO 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/resources/ecosystem/tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: tools 3 | title: "Tools for ZIO" 4 | --- 5 | 6 | - [ZIO IntelliJ](https://github.com/zio/zio-intellij) — A complimentary, community-developed plugin for IntelliJ IDEA, brings enhancements when using ZIO in your projects 7 | - [zio-shield](https://github.com/zio/zio-shield) — Enforce best coding practices with ZIO 8 | - [zio/zio-zmx](https://github.com/zio/zio-zmx) — Monitoring, Metrics and Diagnostics for ZIO -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/resources/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: "Summary" 4 | --- 5 | 6 | If you find a new great library, talk, resource, slides or project, related to ZIO, consider adding to the list with your PR 7 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/resources/learning/cheatsheets.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cheatsheets 3 | title: "Cheat Sheets" 4 | --- 5 | 6 | - [ZIO Cheat Sheet](https://github.com/ghostdogpr/zio-cheatsheet) 7 | - [Snippets for Future/Scalaz Task](https://gist.github.com/ubourdon/7b7e929117343b2324cde6eab57674a6) 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-1.0.18/resources/learning/cookbooks.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: cookbooks 3 | title: "Cookbooks" 4 | --- 5 | 6 | - [ZIO Cookbook](https://github.com/Neurodyne/zio-cookbook) A beginners' tour to ZIO by Boris V.Kuznetsov 7 | - [Mastering modularity in ZIO with ZLayers](https://scalac.io/ebook/mastering-modularity-in-zio-with-zlayer/intro/) by Jorge Vasquez 8 | - [Improve your focus with ZIO Optics](https://scalac.io/ebook/improve-your-focus-with-zio-optics/introduction-5/) by Jorge Vasquez 9 | -------------------------------------------------------------------------------- /website/versions.json: -------------------------------------------------------------------------------- 1 | [ 2 | "1.0.18" 3 | ] -------------------------------------------------------------------------------- /website/yarn.nix: -------------------------------------------------------------------------------- 1 | let pkgs = import <nixpkgs> {}; 2 | 3 | in pkgs.mkShell rec { 4 | name = "webdev"; 5 | 6 | buildInputs = with pkgs; [ 7 | nodejs yarn 8 | ]; 9 | } 10 | --------------------------------------------------------------------------------