Skip to content

Commit c0870eb

Browse files
committed
Make nothing :: Maybe a, remove extra parameter
`nothing` is only used in one place, and as a function it was called incorrectly before: `nothing()` instead of `nothing(undefined)`. This commit fixes that by removing the extra layer of function wrapping entirely, and making `nothing` a constant of type `Maybe a`. This is to avoid the more verbose alternative - adding the `undefined` argument.
1 parent 1e5e256 commit c0870eb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

appendix_a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ const maybe = curry((v, f, m) => {
141141
## nothing
142142

143143
```js
144-
// nothing :: () -> Maybe a
145-
const nothing = () => Maybe.of(null);
144+
// nothing :: Maybe a
145+
const nothing = Maybe.of(null);
146146
```
147147

148148

exercises/ch11/solution_a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const eitherToMaybe = either(_ => nothing(), Maybe.of);
1+
const eitherToMaybe = either(always(nothing), Maybe.of);

exercises/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ const maybe = curry(function maybe(v, f, m) {
579579
return f(m.$value);
580580
});
581581

582-
const nothing = function nothing() { return Maybe.of(null); };
582+
const nothing = Maybe.of(null);
583583

584584
const reject = function reject(x) { return Task.rejected(x); };
585585

0 commit comments

Comments
 (0)