Skip to content

Commit

Permalink
Update recursive-datatypes.md
Browse files Browse the repository at this point in the history
some spelling corrections
  • Loading branch information
GrafBlutwurst committed Mar 8, 2019
1 parent 2ffaf99 commit 73c3ca8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions microsite/src/main/tut/interpreters/recursive-datatypes.md
Expand Up @@ -14,7 +14,7 @@ It is quite easy to define schemas for recursive data types, but extra care must

## Building interpreters

The construction of an interpreter is guarantied to terminate under certain conditions. The `SelfReference` case of the `SchemaF` ADT has a lazy `unroll` field that "performs the recursion". Evaluating this field eagerly in an algebra will make the interpretation diverge, but keeping it unevaluated will guaranty the interpretation to terminate.
The construction of an interpreter is guarantied to terminate under certain conditions. The `SelfReference` case of the `SchemaF` ADT has a lazy `unroll` field that "performs the recursion". Evaluating this field eagerly in an algebra will make the interpretation diverge, but keeping it unevaluated will guarantee the interpretation to terminate.

For example, if we were to write an interpreter for `org.scalacheck.Gen` (that is, to implement an `HAlgebra[Schema, Gen]`), writing the following makes the process diverge:

Expand All @@ -38,7 +38,7 @@ But if we keep the `unroll` field unevaluated, by passing it as a by-name parame

## Non-termination of the derived functor

It is impossible to guaranty non-termination of a derived functor in general, but here are a few tips.
It is impossible to guarantee non-termination of a derived functor in general, but here are a few tips.

* Contravariant functors resembling to a function `A => X` (like, for example, `play.api.libs.json.Writes`) are safe as long as the input data is acyclic.
* Covariant functors resembling to a function `X => A` (like `play.api.libs.json.Reads`) are generaly safe, as long as you can prove that "each step consumes a bit of the `X`".
Expand Down

0 comments on commit 73c3ca8

Please sign in to comment.