phone-number 1.2.0.3: enforce area/exchange not starting with 1#534
phone-number 1.2.0.3: enforce area/exchange not starting with 1#534petertseng merged 1 commit intoexercism:masterfrom petertseng:phone
Conversation
| number :: String -> Maybe String | ||
| number input | ||
| | any isLetter input = Nothing | ||
| number input = clean input >>= check |
There was a problem hiding this comment.
pointfree.io tells me this is number = (check =<<) . clean but I'm not sure I consider that better.
There was a problem hiding this comment.
You code is definitely clearer!
If I where to rewrite it, I would probably "point-free-fy it" with number = clean >=> check, but it has the inconvenience of an additional import.
Does it type-checks?
There was a problem hiding this comment.
I'm enjoying your PRs, @petertseng. The links help a lot. 😄
I just noticed that some descriptions do not exactly match x-common, but I don't think this it is a major problem.
Thanks for this one and all the other PRs. 👍
| , input = "22234567890" | ||
| , expected = Nothing | ||
| } | ||
| , Case { description = "valid when 11 digits and first is 1" |
There was a problem hiding this comment.
"description": "valid when 11 digits and starting with 1",There was a problem hiding this comment.
Since I have a case that says "starting with 1" later on, I might as well change this one to match. Coming right up.
| , input = "(223) 456-7890" | ||
| , expected = Just "2234567890" | ||
| } | ||
| , Case { description = "cleans number with dots" |
There was a problem hiding this comment.
Small difference from canonical-data.json:
"description": "cleans numbers with dots",1.0.1 and 1.0.2: description clarifications exercism/problem-specifications#719 exercism/problem-specifications#724 1.1.0: enforce area/exchange not starting with 1 exercism/problem-specifications#745 1.2.0: 1a2b3c4d5e6f7g8h9i0j removed exercism/problem-specifications#772 Closes #518
* bowling 1.0.0.2: drop unneeded rolls, edit a description * leap 1.0.0.2: explain criteria in descriptions, put in progress order * luhn 1.0.0.2: only test isValid, use (most) x-common cases * phone-number 1.2.0.3: enforce area/exchange not starting with 1 * roman-numerals 1.0.0.2: add descriptions
|
And sorry @rbasso , but I'll need to ask for approval on this one again too |
1.0.1 and 1.0.2: description clarifications
exercism/problem-specifications#719
exercism/problem-specifications#724
1.1.0: enforce area/exchange not starting with 1
exercism/problem-specifications#745
1.2.0: 1a2b3c4d5e6f7g8h9i0j removed
exercism/problem-specifications#772
Closes #518