-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
grade-school: Add signatures to stub so it runs tests #465
Conversation
I'm leaning toward not defining them. There's lots of precedent for not doing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer providing the type synonyms.
@@ -2,10 +2,14 @@ module School (School, add, empty, grade, sorted) where | |||
|
|||
data School = Dummy | |||
|
|||
add = undefined | |||
add :: Int -> String -> School -> School | |||
add gradeNum student school = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have said grade
here, but shadowing the function grade
seems bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I can't think of a better name.
empty = undefined | ||
|
||
grade = undefined | ||
grade :: Int -> School -> [String] | ||
grade gradeNum school = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, the arg should be something other than grade
, so I chose gradeNum
like the example solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah....it's probably better to avoid the type synonyms.
@@ -2,10 +2,14 @@ module School (School, add, empty, grade, sorted) where | |||
|
|||
data School = Dummy | |||
|
|||
add = undefined | |||
add :: Int -> String -> School -> School | |||
add gradeNum student school = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I can't think of a better name.
Lingering work from #421 and #464.
It seems acceptable to define theGrade
andStudent
type 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
Grade
withInt
andStudent
withString
, and let thestudents figure it out on their own.
Although the example solution defines
Grade
andStudent
typesynonyms, we generally leave the definition of these type synonyms to
individual students, so the type signatures provided will just have
Int
andString
.What say y'all? Should we define
Grade
andStudent
, or let the students do it? Do we have a precedent? I will say the only othertype
we ever define in a stub istype Coord = (Int, Int)
ingo-counting
. So I could be convinced to leave this one out.