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

integrated score function #441

Merged
merged 2 commits into from
Nov 24, 2016
Merged

Conversation

abo64
Copy link
Contributor

@abo64 abo64 commented Nov 24, 2016

Changes as discussed in issue #440 .
I found it difficult to rephrase HINTS.md. It assumes the current Requirements of x-common's description.md. Any improvements here are especially welcome.
The example changes are based on the earlier version. So it might not be overly elegant.

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.

Thank you very much, again, @abo64.

Seems great the way it is, so I'm approving it now.

I made some comments anyway, but it is up to you to decide if you want to change anything or not. After you say Go, I'll merge it.

One last thing!

If you get the time and patience, take a look at this link. I'm still trying to get used to follow these guidelines, and I'll will not refuse anything anything different, but I find it useful to get used to them, specially when contributing in repositories that have too many people.

@@ -17,126 +17,127 @@ specs = describe "bowling" $
test Case{..} = it description assertion
where
assertion = result `shouldBe` expected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant space character after assertion.

You will find a dummy data declaration and type signatures already in place,
but it is up to you to define the functions and create a meaningful data type,
newtype or type synonym.
You will find a data declaration for the possible errors as well as the type signature for the `score` function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about not mentioning anything about us diverging from x-common?

Maybe just put the instructions and wait until description.md is fixed. Something like this:

Hints

To complete this exercise you need to implement the function score,
that takes a sequence of bowling rolls and returns the final score or
the appropriate error:

score :: [Int] -> Either BowlingError Int

data BowlingError = IncompleteGame
                  | InvalidRoll { rollIndex :: Int, rollValue :: Int }
                  deriving (Eq, Show)

You will find these definitions already in place, but it is up to you
to define the function.

Keep in mind that the test suite expects the rolls to be numbered
starting from zero.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, @rbasso

To complete this exercise, you need to create the data type `Bowling`
and implement the following functions:
For a functional language like Haskell it makes sense to calculate the game result in one go from the list of rolls (without an extra `roll` function).
This result can then either be the total game score or an error for a list of irregular rolls.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or an error for a list of irregular rolls.

This is a little confusing. Seems like we are expecting a list of errors.

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