Skip to content

Commit e4a6b30

Browse files
authored
Merge pull request palatable#24 from adomokos/ad-fix-typo
Fix typo and clean up white space
2 parents b2d598e + 36b0ce5 commit e4a6b30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ public static void main(String[] args) {
366366
}
367367
```
368368

369-
In the previous example, if any of `parseId`, `lookupById`, or `getOccupation` fail, no further `flatMap` computations can succeed, so the result short-circuits to the first `left` value that is returned. This is completely predictable from the type signature of `Monad` and `Either`: `Either<L, R>` is a `Monad<R>`, so the single arity `flatMap` can have nothing to map in the case where there is no `R` value. With experience, it generally becomes quickly clear what the logical behavior of `flatMap` *must* be given the type signatures.
369+
In the previous example, if any of `parseId`, `lookupById`, or `getOccupation` fail, no further `flatMap` computations can succeed, so the result short-circuits to the first `left` value that is returned. This is completely predictable from the type signature of `Monad` and `Either`: `Either<L, R>` is a `Monad<R>`, so the single arity `flatMap` can have nothing to map in the case where there is no `R` value. With experience, it generally becomes quickly clear what the logical behavior of `flatMap` *must* be given the type signatures.
370370

371371
That's it. Monads are neither [elephants](http://james-iry.blogspot.com/2007/09/monads-are-elephants-part-1.html) nor are they [burritos](https://blog.plover.com/prog/burritos.html); they're simply types that support a) the ability to lift a value into them, and b) a chaining function `flatMap :: (a -> f b) -> f a -> f b` that can potentially return different instances of the same monad. If a type can do those two things (and obeys [the laws](https://wiki.haskell.org/Monad_laws)), it is a monad.
372372

373-
Further, if a type is a monad, it is necessarily an `Applicative`, which makes it necessariliy a `Functor`, so *lambda* enforces this tautology via a hierarchical constraint.
373+
Further, if a type is a monad, it is necessarily an `Applicative`, which makes it necessarily a `Functor`, so *lambda* enforces this tautology via a hierarchical constraint.
374374

375375
### <a name="traversables">Traversables</a>
376376

@@ -504,7 +504,7 @@ Optional.of(1).map(nullResultFn); // Optional.empty()
504504
Maybe.just(1).fmap(nullResultFn); // throws NullPointerException
505505
506506
Maybe.just(1).flatMap(nullResultFn.andThen(Maybe::maybe)); // Nothing
507-
```
507+
```
508508
509509
### <a name="hlists">Heterogeneous Lists (HLists)</a>
510510
@@ -601,7 +601,7 @@ HMap hmap = HMap.hMap(stringKey, "string value",
601601
Optional<String> stringValue = hmap.get(stringKey); // Optional["string value"]
602602
Optional<Integer> intValue = hmap.get(intKey); // Optional[1]
603603
Optional<Integer> anotherIntValue = hmap.get(anotherIntKey); // Optional.empty
604-
```
604+
```
605605

606606
### <a name="coproducts">CoProducts</a>
607607

0 commit comments

Comments
 (0)