Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Gómez committed Jun 6, 2016
1 parent e802cda commit 4fbf2f7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Add the following dependency to your project's build file.
For Scala 2.11.x:

```scala
"com.fortysevendeg" %% "fetch" %% "0.2.0"
"com.fortysevendeg" %% "fetch" % "0.2.0"
```

Or, if using Scala.js (0.6.x):

```scala
"com.fortysevendeg" %%% "fetch" %% "0.2.0"
"com.fortysevendeg" %%% "fetch" % "0.2.0"
```


Expand Down Expand Up @@ -86,22 +86,22 @@ import fetch.syntax._
val fetchOne: Fetch[String] = fetchString(1)
```

We'll run our fetches to the ambiend `Id` monad in our examples, let's do some imports.
We'll run our fetches to the ambien `Id` monad in our examples, let's do some imports.

```scala
import cats.Id
import fetch.unsafe.implicits._
import fetch.syntax._
```

Note that in real-life scenarios you'll want to run a fetch to a concurrency monad, synchronous execution of a fetch
Note that in real-life scenarios you'll want to run a fetch to a concurrency monad such as `Future` or `Task`, synchronous execution of a fetch
is only supported in Scala and not Scala.js and is meant for experimentation purposes.

Let's run it and wait for the fetch to complete:

```scala
fetchOne.runA[Id]
// [111] One ToString 1
// [42] One ToString 1
// res3: cats.Id[String] = 1
```

Expand All @@ -119,7 +119,7 @@ When executing the above fetch, note how the three identities get batched and th

```scala
fetchThree.runA[Id]
// [111] Many ToString OneAnd(1,List(2, 3))
// [42] Many ToString OneAnd(1,List(2, 3))
// res5: cats.Id[(String, String, String)] = (1,2,3)
```

Expand Down Expand Up @@ -154,12 +154,12 @@ And now we can easily receive data from the two sources in a single fetch.
val fetchMulti: Fetch[(String, Int)] = (fetchString(1) |@| fetchLength("one")).tupled
```

Note how the two independent data fetches are run in parallel, minimizing the latency cost of querying the two data sources.
Note how the two independent data fetches run in parallel, minimizing the latency cost of querying the two data sources.

```scala
fetchMulti.runA[Id]
// [111] One ToString 1
// [112] One Length one
// [42] One ToString 1
// [43] One Length one
// res7: cats.Id[(String, Int)] = (1,3)
```

Expand All @@ -178,6 +178,6 @@ While running it, notice that the data source is only queried once. The next tim

```scala
fetchTwice.runA[Id]
// [111] One ToString 1
// [42] One ToString 1
// res8: cats.Id[(String, String)] = (1,1)
```

0 comments on commit 4fbf2f7

Please sign in to comment.