Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch09: fix signature and usage of logFilename in exercise_b #503

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ch09.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ basename from a filepath.

{% initial src="./exercises/ch09/exercise_b.js#L13;" %}
```js
// logFilename :: IO ()
// logFilename :: () -> IO ()
const logFilename = undefined;

```
Expand Down
2 changes: 1 addition & 1 deletion exercises/ch09/exercise_b.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// then purely log it. Hint: you may want to use `split` and `last` to obtain the
// basename from a filepath.

// logFilename :: IO ()
// logFilename :: () -> IO ()
const logFilename = undefined;
8 changes: 4 additions & 4 deletions exercises/ch09/validation_b.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* globals logFilename */

assert(
logFilename() instanceof IO,
'The function gives incorrect results; hint: `logFilename` should be an IO()',
logFilename(undefined) instanceof IO,
'The function gives incorrect results; hint: `logFilename` should return an IO()',
);

if (logFilename().unsafePerformIO() instanceof IO) {
if (logFilename(undefined).unsafePerformIO() instanceof IO) {
throw new Error('The function gives incorrect results; hint: make sure to `chain` effects as you go');
}

assert(
logFilename().unsafePerformIO() === 'ch09.md',
logFilename(undefined).unsafePerformIO() === 'ch09.md',
'The function gives incorrect results; hint: did you retrieve the file\'s basename ?',
);