Skip to content

Format integers correctly#32

Merged
emhoracek merged 3 commits intomasterfrom
format-integers-correctly
Jan 24, 2017
Merged

Format integers correctly#32
emhoracek merged 3 commits intomasterfrom
format-integers-correctly

Conversation

@emhoracek
Copy link
Member

No description provided.

Some fields in the JSON are numbers -- and numbers in JSON are all one type. Aeson sees them as this "Scientific" number -- a float or double? So if WordPress has a post with an "id" 34234, then Offset fills it as "34234.0". Which is bad when we're creating links to "author/${wpId}".

The problem seems to be that Fields have some different types, like objects or lists, but there's no "type" that says anything about the content of a field.

Ideally, it would be getting a JSON Number, then trying to convert that into an Integer. But what the "build splices"
This reverts commit a29cdf7.
@emhoracek emhoracek requested a review from mattraibert January 24, 2017 18:36
@emhoracek
Copy link
Member Author

@mattraibert Could also do: either tshow tshow (floatingOrInteger i), either has the type (a -> c) -> (b -> c) -> Either a b -> c

@emhoracek emhoracek merged commit 3dd7f2d into master Jan 24, 2017
@emhoracek emhoracek deleted the format-integers-correctly branch January 24, 2017 18:59
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.

1 participant