TODO: Add project description.
import cats.effect._
import cats.implicits._
import com.vsthost.rnd.habitat.console.Console
import com.vsthost.rnd.habitat.console.Console.implicits._
import scala.language.higherKinds
def instructions[F[_]: Sync: Console]: F[Unit] = for {
_ <- Console[F].putStrLn("Hello!")
_ <- Console[F].putStr("What is your name?")
i <- Console[F].readLn[String]
_ <- i match {
case Left(e) => Console[F].putErrLn(e)
case Right(n) => Console[F].putStrLn(s"Nice to meet you $n.")
}
} yield ()
instructions[IO].unsafeRunSync()
Copyright (c) 2018 Vehbi Sinan Tunalioglu <[email protected]>
habitat-console is licensed under Apache 2.0 License.