Skip to content

grade-school: Add signatures to stub so it runs tests#465

Merged
rbasso merged 1 commit intoexercism:masterfrom
petertseng:grade-school-stub
Jan 8, 2017
Merged

grade-school: Add signatures to stub so it runs tests#465
rbasso merged 1 commit intoexercism:masterfrom
petertseng:grade-school-stub

Conversation

@petertseng
Copy link
Copy Markdown
Member

@petertseng petertseng commented Jan 8, 2017

Lingering work from #421 and #464.

It seems acceptable to define the Grade and Student type synonyms in
the 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 all
instances of Grade with Int and Student with String, and let the
students figure it out on their own.

Although the example solution defines Grade and Student type
synonyms, we generally leave the definition of these type synonyms to
individual students, so the type signatures provided will just have
Int and String.


What say y'all? Should we define Grade and Student, or let the students do it? Do we have a precedent? I will say the only other type we ever define in a stub is type Coord = (Int, Int) in go-counting. So I could be convinced to leave this one out.

@petertseng
Copy link
Copy Markdown
Member Author

I'm leaning toward not defining them. There's lots of precedent for not doing it.

Lingering work from #421 and #464.

Although the example solution defines `Grade` and `Student` type
synonyms, we generally leave the definition of these type synonyms to
individual students, so the type signatures provided will just have
`Int` and `String`.
Copy link
Copy Markdown
Member Author

@petertseng petertseng left a 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.


add = undefined
add :: Int -> String -> School -> School
add gradeNum student school = undefined
Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Contributor

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.


grade = undefined
grade :: Int -> School -> [String]
grade gradeNum school = undefined
Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Contributor

@rbasso rbasso left a 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.


add = undefined
add :: Int -> String -> School -> School
add gradeNum student school = undefined
Copy link
Copy Markdown
Contributor

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.

@rbasso rbasso merged commit 4a91a03 into exercism:master Jan 8, 2017
@petertseng petertseng deleted the grade-school-stub branch January 8, 2017 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants