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

Add instances for Data.Fixed #77

Closed
fizruk opened this issue Aug 4, 2018 · 0 comments
Closed

Add instances for Data.Fixed #77

fizruk opened this issue Aug 4, 2018 · 0 comments

Comments

@fizruk
Copy link
Owner

fizruk commented Aug 4, 2018

There are missing instances for fixed point numbers, for example:

>>> import Data.Fixed
>>> import Web.HttpApiData
>>> toUrlPiece (1.5 :: Milli)

<interactive>:13:1: error:
    • No instance for (ToHttpApiData Milli)
        arising from a use of ‘toUrlPiece’
    • In the expression: toUrlPiece (1.5 :: Milli)
      In an equation for ‘it’: it = toUrlPiece (1.5 :: Milli)
rockbmb added a commit to rockbmb/http-api-data that referenced this issue Oct 2, 2018
rockbmb added a commit to rockbmb/http-api-data that referenced this issue Oct 2, 2018
rockbmb added a commit to rockbmb/http-api-data that referenced this issue Oct 3, 2018
@fizruk fizruk closed this as completed in #87 Oct 5, 2018
rockbmb added a commit to rockbmb/http-api-data that referenced this issue Oct 8, 2018
…sion suffices

`nominalDiffTimeToSeconds` was introduced in `time-1.9.1` and has type
`nominalDiffTimeToSeconds :: NominalDiffTime -> Pico`, which is what
is needed for `toUrlPiece` in `ToHttpApiData`, now that after issue fizruk#77
there are instances for types from `Data.Fixed`.

As such, if the `time` library's version is high enough, that
function will be used. Otherwise,
`(realToFrac :: NominalDiffTime -> Pico)` will be used instead.
phadej pushed a commit that referenced this issue Nov 13, 2018
encode whole range.

Add CPP to use `nominalDiffTimeToSeconds` if `time`'s version suffices

`nominalDiffTimeToSeconds` was introduced in `time-1.9.1` and has type
`nominalDiffTimeToSeconds :: NominalDiffTime -> Pico`, which is what
is needed for `toUrlPiece` in `ToHttpApiData`, now that after issue #77
there are instances for types from `Data.Fixed`.

As such, if the `time` library's version is high enough, that
function will be used. Otherwise,
`(realToFrac :: NominalDiffTime -> Pico)` will be used instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant