Skip to content

Tagless Final Console Algebra and Implementation (It works for me)

Notifications You must be signed in to change notification settings

vst/habitat-console

Repository files navigation

habitat-console

TODO: Add project description.

Example

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()

License

Copyright (c) 2018 Vehbi Sinan Tunalioglu <vst@vsthost.com>

habitat-console is licensed under Apache 2.0 License.

About

Tagless Final Console Algebra and Implementation (It works for me)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages