Skip to content

Add integral number combinator - #27

Merged
mjgpy3 merged 2 commits into
masterfrom
add-integral-number-combinator
Sep 29, 2017
Merged

Add integral number combinator#27
mjgpy3 merged 2 commits into
masterfrom
add-integral-number-combinator

Conversation

@ntreu14

@ntreu14 ntreu14 commented Sep 7, 2017

Copy link
Copy Markdown
Contributor

This PR aims to resolve issue #15.

valid <| validate (NumberThat [IsIntegral]) (JsonValue.Number 0M)
valid <| validate (NumberThat [IsIntegral]) (JsonValue.Number -42M)
invalid <| validate (NumberThat [IsIntegral]) (JsonValue.Number 42.94M)
invalid <| validate (NumberThat [IsIntegral]) (JsonValue.Number -42.94M)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is interesting to note that a JsonValue.Number or JsonValue.Float ending with a .0 will validate.

I believe that this is reasonable because 42 = 42.0 mathematically speaking. I would love to hear your thoughts @mjgpy3.

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.

I think that's totally acceptable!

@mjgpy3
mjgpy3 merged commit cf025fb into master Sep 29, 2017
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