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

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

Merged
merged 1 commit into from
Jan 8, 2017
Merged

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

merged 1 commit into from
Jan 8, 2017

Conversation

petertseng
Copy link
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
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
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.

@@ -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
Copy link
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
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.

empty = undefined

grade = undefined
grade :: Int -> School -> [String]
grade gradeNum school = undefined
Copy link
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
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.

@@ -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
Copy link
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