Skip to content

Commit 51f1f71

Browse files
authored
Add example using F in the docs, fixes #356 (#358)
1 parent ef1d0e5 commit 51f1f71

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

docs/docs/docs.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ val accessToken = sys.env.get("GITHUB4S_ACCESS_TOKEN")
2525

2626
In order for Github4s to work, you'll need an appropriate implicit `ExecutionContext` in Scope.
2727

28-
Github4s is a Tagless Final API.
28+
Github4s uses [Tagless Final encoding](https://typelevel.org/blog/2017/12/27/optimizing-final-tagless.html).
2929

30-
Every Github4s API call returns an `F[GHResponse[A]]` where `F` has an instance of [cats.effect.ConcurrentEffect][cats-concurrent-effect]
30+
Every Github4s API call returns an `F[GHResponse[A]]` where `F` has an instance of [cats.effect.ConcurrentEffect][cats-concurrent-effect].
3131

3232
`GHResponse[A]` is, in turn, a type alias for `Either[GHException, GHResult[A]]`.
3333

@@ -46,6 +46,20 @@ val user1 = Github[IO](accessToken).users.get("rafaparadela")
4646

4747
`user1` in this case is a `IO[GHResponse[User]]`.
4848

49+
### Using `F[_]: cats.effect.ConcurrentEffect`
50+
51+
```scala mdoc:compile-only
52+
object ProgramF {
53+
import cats.effect.ConcurrentEffect
54+
import scala.concurrent.ExecutionContext
55+
import github4s.Github
56+
import github4s.GithubResponses.GHResponse
57+
import github4s.domain.User
58+
59+
def u1[F[_]: ConcurrentEffect](implicit ec: ExecutionContext): F[GHResponse[User]] =
60+
Github[F](accessToken).users.get("juanpedromoreno")
61+
}
62+
```
4963

5064
### Using `cats.effect.IO`
5165

@@ -144,4 +158,4 @@ object ProgramEvalWithHeaders {
144158

145159
[access-token]: https://github.com/settings/tokens
146160
[cats-concurrent-effect]: https://typelevel.org/cats-effect/typeclasses/concurrent-effect.html
147-
[monix-task]: https://monix.io/docs/3x/eval/task.html
161+
[monix-task]: https://monix.io/docs/3x/eval/task.html

docs/docs/project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Github4s supports the [Project API](https://developer.github.com/v3/projects/).
1515
with Github4s, you can interact with:
1616

1717
- [Project](#project)
18-
- [List projects](#list-project)
18+
- [List projects](#list-projects)
1919
- [Columns](#columns)
20-
- [List project columns](#list-projects-columns)
20+
- [List project columns](#list-project-columns)
2121

2222
The following examples assume the following imports and token:
2323

0 commit comments

Comments
 (0)