grade-school: Add signatures to stub so it runs tests#465
Merged
rbasso merged 1 commit intoexercism:masterfrom Jan 8, 2017
petertseng:grade-school-stub
Merged
grade-school: Add signatures to stub so it runs tests#465rbasso merged 1 commit intoexercism:masterfrom petertseng:grade-school-stub
rbasso merged 1 commit intoexercism:masterfrom
petertseng:grade-school-stub
Conversation
Member
Author
|
I'm leaning toward not defining them. There's lots of precedent for not doing it. |
petertseng
commented
Jan 8, 2017
Member
Author
petertseng
left a comment
There was a problem hiding this comment.
No longer providing the type synonyms.
|
|
||
| add = undefined | ||
| add :: Int -> String -> School -> School | ||
| add gradeNum student school = undefined |
Member
Author
There was a problem hiding this comment.
I would have said grade here, but shadowing the function grade seems bad.
Contributor
There was a problem hiding this comment.
Makes sense. I can't think of a better name.
|
|
||
| grade = undefined | ||
| grade :: Int -> School -> [String] | ||
| grade gradeNum school = undefined |
Member
Author
There was a problem hiding this comment.
again, the arg should be something other than grade, so I chose gradeNum like the example solution.
rbasso
approved these changes
Jan 8, 2017
Contributor
rbasso
left a comment
There was a problem hiding this comment.
Yeah....it's probably better to avoid the type synonyms.
|
|
||
| add = undefined | ||
| add :: Int -> String -> School -> School | ||
| add gradeNum student school = undefined |
Contributor
There was a problem hiding this comment.
Makes sense. I can't think of a better name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lingering work from #421 and #464.
It seems acceptable to define theGradeandStudenttype synonyms inthe stub, so that the expected return types of the functions will all be
self-explanatory.
The alternative is, of course, not to define them, and replace allinstances of
GradewithIntandStudentwithString, and let thestudents figure it out on their own.
Although the example solution defines
GradeandStudenttypesynonyms, we generally leave the definition of these type synonyms to
individual students, so the type signatures provided will just have
IntandString.What say y'all? Should we define
GradeandStudent, or let the students do it? Do we have a precedent? I will say the only othertypewe ever define in a stub istype Coord = (Int, Int)ingo-counting. So I could be convinced to leave this one out.