Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

zio-archive/interop-twitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Interop

Project stage CI Releases Snapshots

This library provides capability to convert Twitter Future into ZIO Task.

Example

import com.twitter.util.Future
import zio.{ App, Task }
import zio.console._
import zio.interop.twitter._

object Example extends App {
  def run(args: List[String]) = {
    val program =
      for {
        _        <- putStrLn("Hello! What is your name?")
        name     <- getStrLn
        greeting <- Task.fromTwitterFuture(greet(name))
        _        <- putStrLn(greeting)
      } yield ()

    program.exitCode
  }

  private def greet(name: String): Future[String] = Future.value(s"Hello, $name!")
}