From e5bfdfd8a4f07c13b91354ed03a8d5bf14b5e054 Mon Sep 17 00:00:00 2001 From: Eugene Sharygin Date: Mon, 18 Feb 2019 21:06:43 +0300 Subject: [PATCH 1/2] ch09: fix signature and usage of logFilename in exercise_b This fixes type signature of function `logFilename` constructed in exercise_b, and changes its usage to match the type of the `()` parameter. --- exercises/ch09/exercise_b.js | 2 +- exercises/ch09/validation_b.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/ch09/exercise_b.js b/exercises/ch09/exercise_b.js index 8f97a4a8..6ace8bd3 100644 --- a/exercises/ch09/exercise_b.js +++ b/exercises/ch09/exercise_b.js @@ -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; diff --git a/exercises/ch09/validation_b.js b/exercises/ch09/validation_b.js index 0740ef97..05948d6c 100644 --- a/exercises/ch09/validation_b.js +++ b/exercises/ch09/validation_b.js @@ -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 ?', ); From 77121aa7d496e264be4f56e7a7d010cb89e8a9d1 Mon Sep 17 00:00:00 2001 From: Eugene Sharygin Date: Tue, 19 Feb 2019 09:10:31 +0300 Subject: [PATCH 2/2] ch09: fix signature of logFilename in the chapter text --- ch09.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch09.md b/ch09.md index bd3c4612..57746231 100644 --- a/ch09.md +++ b/ch09.md @@ -438,7 +438,7 @@ basename from a filepath. {% initial src="./exercises/ch09/exercise_b.js#L13;" %} ```js -// logFilename :: IO () +// logFilename :: () -> IO () const logFilename = undefined; ```