grains: Change return type to Maybe#197
grains: Change return type to Maybe#197rbasso merged 1 commit intoexercism:masterfrom rbasso:grains-change-return-to-maybe
Conversation
Change the return type of function `square` from an `Integer` to a `Maybe Integer`. Add three test: - `square (-1)` - `square 0 ` - `square 65 ` Add a stub solution.
|
Change seems good here, 👍 Might be good to see if this should be specified in x-common? |
|
Maybe we don't need to change there:
Should we write something in |
|
Yeah we can see if other tracks might want to check for out of bounds values like here. Maybe they'll like it, in which case it can be standard for all tracks. Or maybe they won't, an argument against might be exercism/problem-specifications#287 (comment) , but that means it'll just be a specific characteristic of this track. |
|
I think that |
Currently, the exercise
grainshas a functionsquare :: Int -> Integerthat returns the number of grains of wheat on sequentially numbered squares on a chessboard. The problem doesn't specify what should be returned if the number given is not in the chessboard.This is a great opportunity to make it more idiomatic and get the users acquainted with
Maybe.I propose to to the following:
squarefrom anIntegerto aMaybe Integer.square (-1)square 0square 65