https://github.com/vst/habitat-console
Tagless Final Console Algebra and Implementation (It works for me)
https://github.com/vst/habitat-console
Last synced: 10 months ago
JSON representation
Tagless Final Console Algebra and Implementation (It works for me)
- Host: GitHub
- URL: https://github.com/vst/habitat-console
- Owner: vst
- Created: 2018-10-02T05:09:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-02T06:10:19.000Z (almost 8 years ago)
- Last Synced: 2023-07-03T01:46:56.109Z (about 3 years ago)
- Language: Scala
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
Awesome Lists containing this project
README
# habitat-console
> **TODO:** Add project description.
## Example
```scala
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](https://www.apache.org/licenses/LICENSE-2.0).